By Joshua Schneyer

RIO DE JANEIRO (Reuters) - Defending champion Andy Murray survived a scare to reach the quarter-finals of the men's Olympic tennis tournament with a three-set victory over Fabio Fognini on Thursday.

Murray won 6-1 2-6 6-3 after rallying from a 3-0 third-set deficit against the Italian, who won eight straight games before the Briton regained control.

Spain's Rafa Nadal also booked his spot in the last eight with a 7-6(5) 6-3 win over Frenchman Gilles Simon.

The Olympic tennis tournament has been marked by some major upsets in the opening rounds and both Murray and Nadal were tested on Thursday, in gusty conditions after rain delays had canceled play on Wednesday.

The momentum shifts in Murray's match were striking. The Italian mounted an aggressive counter-attack after Murray won the first set easily, repeatedly wrong-footing the Briton on the baseline, or drawing him in with drop shots. But Murray turned it around to win the last six games.

"It wasn't pretty, but I won," he told reporters. "The wind was swirling everywhere, so it was just really tough conditions for us to play well."

Murray, who now faces Steve Johnson of the United States, is favorite to clinch a second straight gold medal following the first-round exit of world number one Novak Djokovic to Argentina's Juan Martin Del Potro.

Brazil's Thomaz Belucci beat Belgium's David Goffin in two close sets on Thursday to set up a quarter-final clash between against Nadal.

Japan's Kei Nishikori will play France's Gael Monfils, and Del Potro is up against Spain's Roberto Bautista Agut.

Also advancing on Thursday to the women's semi-final was American Madison Keys, who beat Russia's Daria Kasatkina in straight sets. She now faces Germany's Angelique Kerber while Puerto Rican Monica Puig will meet Petra Kvitova of the Czech Republic.

Due to weather delays on Wednesday, tournament organizers have yet to announce a definitive schedule for the next round of singles matches, which could begin on Friday.

(Additional reporting by Martyn Herman; Editing by Toby Davis and Neil Robinson)