In the acclaimed 2002 drama City of God, named for the eponymous slum in Rio de Janeiro, a boy named Rocket spends the entire film walking a line between comfort and peril.

At the Rio Open Saturday night, a man named Rafa did much the same.

Rafa was on clay, his equivalent of shag carpet to a sleepy puppy, after an Australian hard-court swing that abruptly ended in disaster. But the world No. 1 says he’s still not at peak health, and for large portions of this match he played with a nervous air. More to the point was his opponent, Pablo Andujar, the vacuum cleaner to that resting dog. He disturbed Rafa all evening with his backhand, a two-handed swipe that moved through the dirt with the seeming velocity of his countryman’s famous forehands. Mentally he was just as strong, and he rightfully earned two match points in this drama’s climax, a third-set tiebreaker.

On the big screen and on the center court, anxiety and tension ran sky high. But—and do I need to say SPOILER ALERT after 12 years?—both main characters survived. Barely. In Rafael Nadal’s case, it was reflected in the 2-6, 6-3, 7-6 (10) final score of a match that rewarded viewers who watched all the way through its frenetic conclusion.

Andujar, a clay-court specialist but a commendable No. 40 in the rankings, figured to make a cameo appearance in the semifinals considering Nadal’s two prior matches, drubbings of dirtballers Albert Montanes (6-1, 6-2) and Joao Sousa (6-1, 6-0). But Andujar came into this contest off an awfully impressive win of his own, a 6-1, 6-1 annihilation of Tommy Robredo. For those who overlooked that result—including me, I’ll be the first to admit—you only needed to watch Andujar’s confidence in the first set to recognize that the favorite would need to raise his level. He broke Nadal to open the match, then opened up an insurmountable double-break lead.

Nadal finally answered the call in the second set, breaking Andujar for the first time for 3-1. But it was not an entirely convincing performance. He didn’t test Andujar enough in his service games, and he played just as much defense as offense—it was the underdog who had more short balls and harmless deep shots with which to do what he could. Nadal was not at his best; he wouldn’t be until the tiebreaker, he said after all was said and done.

Both men had chances to avoid that tiebreaker. Andujar earned four break points during Nadal’s first two service games of the final set; Rafa led it by a break at 4-3. But Nadal’s serving—he did that better than anything else today—and Andujar’s all-around play kept either man from winning the set in less than 13 games.

“The tiebreak was a lottery,” Nadal said afterward. Indeed, there were pivotal shots that could have swung the match in either direction. After the session began with three mini-breaks, Nadal rallied from 1-2 down to 5-3 up. He earned his first match point at 6-5, only to see Andujar fire a forehand on the sideline, following that with a far-less risky forehand winner. On Andujar’s first match point, at 7-6, it was Nadal’s turn to be bold. He hit out on his second serve, eliciting a backhand error from Andujar. 7-7.

It was 8-7, Nadal, when Andujar unleashed tennis’ delicate weapon, the half volley. Nadal’s cross-court backhand was able, but Andujar’s riposte was admirable. Andujar earned his second match point with that same, wondrous shot, but Nadal again served with brio when he had to; the service return was no match for the net. 9-9.

At this point, only one thing was clear: Both men were walking a tightrope—there was no comfort below; all peril. Andujar wobbled once more at 9-9, but down 9-10, he dictated terms with his serve. But he was unable to do that after putting a backhand slice into net at 10-10, giving Nadal his fourth match point—and his first on serve. “I played one of the best matches of my life,” Andujar said afterward. “Maybe the best. But I had a great one across from me.”

If at first you don’t succeed, try, try, try again—and on that final try, Nadal succeeded. Barely.