Defending champion Roger Federer and Rafael Nadal set up a mouth-watering showdown in the BNP Paribas quarter-finals after they battled through tricky fourth-round encounters on Wednesday. Federer rode his luck to scrape past fellow Swiss Stanislas Wawrinka 6-3 6-7 7-5 while Nadal had to come from a set down to beat talented Latvian qualifier Ernests Gulbis 4-6 6-4 7-5. Federer last played Nadal a year ago, also at Indian Wells, when the Swiss won their semi-final 6-3 6-4. Third seed Andy Murray needed almost two hours to beat Carlos Berlocq of Argentina 7-6 6-4 and will next face seventh-seeded Juan Martin Del Potro of Argentina, who overpowered German Tommy Haas 6-1 6-2. Four-times Indian Wells champion Federer appeared to be in cruise control serving for the match at 5-4 in the second but was broken to love before his opponent went on to clinch the set in a tiebreak 7-4. The players traded early breaks of serve in the third before Federer sealed the win by again breaking Wawrinka in the 12th game when his compatriot and good friend netted a forehand. “Today it was extremely close again,” Federer told reporters after coming out on top of a fluctuating contest lasting two hours 20 minutes. “He usually plays me pretty good actually overall. “Okay, I should maybe close it out in the second set, but he did well to stay in it. At the end, I don’t know what gets me through. “Maybe it’s the experience or maybe I’m a bit more calm in those moments. I’m not sure. Today I think I was a little lucky to come through it in the end,” added Federer, who improved his record against Wawrinka to 13-1. Nadal, playing his first hardcourt event in almost a year, lost a closely contested opening set to Gulbis when he hit a forehand long on the first break point of the match. However, the left-hander steadily upped his game to take control of the next two sets as the two players treated a packed house at the Indian Wells Tennis Garden with a brilliant display of shot-making. Twice champion Nadal broke Gulbis for the final time in the 11th game of the third set when his opponent dumped a forehand into the net, then served out in the 12th, sealing victory with a whipped forehand winner down the line. “Always against Ernests it is very difficult, he is a very aggressive player with a big serve,” Nadal, who is continuing his comeback after being sidelined for seven months last year by a left knee injury, said courtside. “I played not my best in the first set ... but I am through and that’s the most important thing.” US Open champion Murray, a losing finalist here in 2009, advanced with a straight sets victory that featured seven service breaks, plenty of grunting by the Argentine and a series of protracted games. “It was tough,” said the Scotsman, who took the first-set tiebreak 7-4. “He started well and he was playing very aggressive. He had a lot of chances in the first set. “And then the second set was kind of the other way around. I had a lot of chances, but it was still tight. All the games were pretty close, a lot of long games and longish rallies.” In other matches, sixth-seeded Czech Tomas Berdych eased past Frenchman Richard Gasquet 6-1 7-5 while eight-seeded Jo-Wilfried Tsonga came from a set down to beat Canada’s Milos Raonic 4-6 7-5 6-4. Earlier, big-serving South African Kevin Anderson became the first player to reach the last eight, and his second ATP Masters 1000 quarter-final, with a 6-3 1-6 6-4 victory over Frenchman Gilles Simon. Australian Open champion and top seed Novak Djokovic was scheduled to play big-serving American Sam Querrey later on Wednesday.