Ireland's James McGee defied cramp and missed opportunities to defeat Zhang Ze and qualify for the main draw of the US Open.

It is the first time the 27-year-old has come through qualifying at a grand slam and there was no shortage of drama on a packed Court 8 at Flushing Meadows during his 0-6 6-4 6-4 victory.

McGee, no doubt benefiting from the close ties between New York and Ireland, was a crowd favourite from the start but lost the opening set to love in just 23 minutes.

He turned things round early in the second against his Chinese opponent, though, and looked on course for victory at 5-2 in the third.

But McGee's body began to give out on him and Zhang retrieved one break before holding serve to close the gap further.

Serving for the biggest win of his life for a second time, the world number 195 led 40-0, only to see all three match points slip away, the final one on a double fault.

There was not a spare vantage point to be had as the crowd lapped up the drama and, after missing one more match point, McGee finally clinched victory on his fifth chance.

The Dublin man lay flat on his back on the court soaking up the adulation before the emotion overwhelmed him.

His smile as wide as the Hudson, McGee was still signing autographs while the players for the next match on the court warmed up.

The victory guarantees him a pay day worth at least $36,000substantially the biggest of his life and a quarter of all the prize money he has earned during his career.