INDIAN WELLS, Calif. (AP) -- Rafael Nadal ended the run of Latvian qualifier Ernests Gulbis with a 4-6, 6-4, 7-5 victory in the fourth round at the BNP Paribas Open on Wednesday night.
Nadal advanced to the quarterfinals against defending champion Roger Federer, who survived a three-set marathon of his own, beating 18th-seeded Stanislas Wawrinka 6-3, 6-7 (4), 7-5.
Maria Sharapova and top-ranked Novak Djokovic had yet to play their night matches after all four of the preceding matches on the main stadium court went three sets, extending the day session until 10 p.m. PDT.
Gulbis was on a 13-match winning streak, having made his way through the qualifying rounds at Delray Beach, Fla., where he won the title, and at Indian Wells, where he won three main-draw matches, including two over seeded players.
He was playing his 14th match in 19 days, and has yet to beat Nadal in five tries.
Gulbis held serve to lead 5-4 in the third. He led 30-15 on Nadal's serve, but lost the next five points to let Nadal tie the set.
Nadal earned the only break of the third to go up 6-5, then closed out the win on his third match point. He leapt in the air, tore off his headband and pumped his left arm, yelling, "Yeah!"
The fifth-seeded Spaniard opened his bid for a third Indian Wells title with a two-set victory over American Ryan Harrison, Nadal's first hard-court match in nearly a year.
He returned to the ATP Tour a month ago, winning two of three tournaments on clay after missing seven months because of a left knee injury. Nadal, shaken by an earthquake that rattled Indian Wells on Monday, had a walkover in his third-round match when Leonardo Mayer withdrew with a bad back.