The 15th-seeded Keys had comfortably won the opening set but was broken by the Chinese in the third game of the second and immediately took a medical time out for treatment to what appeared to be a left leg injury.

American Keys then found it difficult to move around the court and the 27-year-old Zhang used that to her advantage to make the American chase the ball and send it to a decider.

Keys, a semi-finalist last year, looked on the verge of retiring several times in the deciding set but battled on grimly despite being in obvious pain.

The 133rd-ranked Zhang struggled to control her nerves in the decider, but eventually held it together to set up a quarter-final against unseeded Briton Johanna Konta.

The last qualifier to reach the Australian Open quarter-finals was Mexico's Angelica Gavaldon in 1990.

"I was very lucky today," a smiling Zhang said in an on-court interview.

(Reporting by Greg Stutchbury; Editing by Martyn Herman)