Andy Murray battled through the pain to defeat Robin Haase in four sets and progress to the second round of the US Open in New York.
The eighth seed struggled with cramp and looked in real danger of suffering a shock exit after losing nine straight games to his Dutch opponent before sealing a 6-3 7-6 (8-6) 1-6 7-5 victory at the Louis Armstrong Stadium.
British number one Murray will meet German Matthias Bachinger, who beat Radek Stepanek 6-3 6-2 6-2, in his first round clash.
Murray needed five sets to overcome Haase when they met in this competition three years ago but clinched the first two in this encounter despite a number of double faults, sealing the second at the third time of asking.
Victory seemed in sight for the Scotsman but a worrying bout of cramp destabilised the 2012 champion who was broken three times as Haase sealed the third set.
Unable to call upon a trainer, Murray battled through the pain as Haase also suffered in the heat in New York. As both men laboured, Murray summoned enough strength to reach match point in the fourth set, securing the decisive point at the third time of asking to progress.
"I started cramping at the beginning of the third set, at the front of my quad and then in my forearm," Murray told BBC Sport.
"It was not particularly comfortable and I just tried to hang around as long as possible and managed to get through.
"I was in a good position at 2-0 up but I didn't know whether to go for it at the beginning of the third set or conserve energy and go for it in the fourth.
"It wasn't easy for Robin either."