Even Canadian teenager Denis Shapovalov was amazed he had beaten tennis superstar Rafael Nadal.

The 18-year-old from Richmond Hill, Ont. shocked himself, the crowd that roared with every point he scored, and the tennis world with his 3-6, 6-4, 7-6 (4) victory over top-seeded Nadal in the third round of the Rogers Cup on Thursday night at a sold out Uniprix Stadium in Montreal.

Shapovalov dropped to the ground and covered his face in joy and surprise as the cheers reached deafening levels after the match point fell, completing his comeback from a 3-0 deficit in the third-set tiebreaker.

"It's what I dreamed of all my life growing up, playing guys like Rafa [Nadal], Roger [Federer], Andy [Murray]," said Shapovalov. "You know, my dream came true today."

The victory put him into a quarter-final Friday against France's Adrian Mannarino, who beat Hyeon Chung 6-3,6-3.

It was one of the biggest wins in Canadian tennis history and it came at the tournament that some still call the Canadian Open.

Match Wrap: Shapovalov upsets Nadal, advances to Rogers Cup quarter-finals2:04

Shapovalov became the youngest player to reach the tournament's quarter-finals since Bjorn Borg in 1974.

He also became the youngest quarter-finalist at a Masters Series tournament ever and is the youngest to beat a player ranked in the top two in the world since Nadal beat Federer in 2004 in Miami.

Shapovalov will reach his goal of moving into the top 100 in the world in a week that saw him save four match points in a first round win over Rogerio Dutra Silva, then beat 2009 U.S. Open winner Juan Martin Del Potro in the second round before toppling Nadal.

"I'm very thankful that I'm in this position," said Shapovalov, who had hockey great Wayne Gretzky and Olympic swimming star Penny Oleksiak cheering for him from the seats. "If I didn't save those four match points in the first round, there wouldn't even be a chance to play Juan Martin or Rafa.

"It's difficult to say how I was feeling during the match. It was extremely hard physically and mentally. Rafa is such a warrior. I'm just so happy to come out with the win."

Nadal sees potential

Nadal, who could have claimed the No. 1 ranking if he had reached the semifinals this week, said it was the worst match he played all year, but he had kind words for Shapovalov.

"He played well," the 31-year-old said. "He has a great potential.

"I wish him the best. He has everything to become a great player. He played with the right determination in the important moments."

Shapovalov looked unfazed in facing the biggest opponent of his young career. After Nadal cruised through the first set, Shapovalov kept battling, breaking service while taking a 3-0 lead in the second. When Nadal would start taking a control of a game, the younger of the two lefthanders would respond with big serves or impressive forehands down the lines.

Nadal fought off two break points to hold serve at 4-2, then earned his own break to win back the momentum from the 2016 Wimbledon junior boys champion, only to see Shapovalov snatch it back and clinch the second set.

The two held serve through the third. Nadal went up 3-0, but Shapovalov used two aces to fight back and complete the upset victory over the 10-time French Open champion.

Federer overcomes rough start

Roger Federer isn't one to gloat over his stunning record against former top-10 opponent David Ferrer.

Without playing especially well, the 19-time Grand Slam champion from Switzerland defeated Ferrer 4-6, 6-4, 6-2 in the third round of the Rogers Cup on Thursday, stretching his career record against the Spaniard to 17-0. It started with a win in Vienna in 2003.

"Maybe in the beginning he was not as good as he is now," said Federer. "Maybe I won five times because I'm better than he was.

"I was No. 1 in the world. I played him on hard courts also. I didn't play him often on clay. Also, there were many tight matches, so maybe it became a mental thing for him. I have a lot of respect for David. As a person, he's very nice. He's a great fighter on the court. So this type of head-to-head is a bit strange."

TEN Rogers Cup Men 20170810

Roger Federer plays a backhand during his victory over David Ferrer Thursday at the Rogers Cup men's event in Montreal. (Paul Chiasson/Canadian Press)

In Friday's quarter-finals, second-seeded Federer will face 12th-seeded Roberto Bautista Agut of Spain, who outlasted Frenchman Gael Monfils 4-6, 7-6(5), 7-6 (2) on centre court at Uniprix Stadium.

Unseeded Argentine Diego Schwartzman posted a strange win over American Jared Donaldson 0-6, 7-5, 7-5 to advance to a quarter-final meeting with Robin Haase, the 52nd-ranked Dutchman who upset seventh-seeded Grigor Dimitrov of Bulgaria 7-6 (3), 4-6, 6-1.

Federer, who breezed past Canadian Peter Polansky in the second round on Wednesday, looked lost in the opening set, spraying balls long, wide or into the net, but gradually rediscovered at least some of the form that has seen the 36-year-old Swiss put back the clock with two grand slam wins this year.​

karolina-pliskova

Karolina Pliskova defeated qualifier Naomi Osaka 6-2, 6-7 (4), 1-0 to open up play at the Rogers Cup. (Nathan Denette/Canadian Press)

WOMEN: Pliskova moves on to quarters

Japanese qualifier Naomi Osaka was brimming with confidence after taking a set off the world's top-ranked women's tennis player on Thursday at the Rogers Cup women's event in Toronto.

Any hope of completing a major upset over Karolina Pliskova was dashed moments later.

After her serve was broken to open the third set, Osaka decided to retire from the match due to an abdominal injury. That gave Pliskova a 6-2, 6-7 (4), 1-0 victory and a berth in the quarter-finals.

It wasn't immediately clear when Osaka suffered the injury. She was in form during the tiebreaker, firing a service winner to convert her second set point under the warm sun at Aviva Centre.

Pliskova came out strong to open the third set and Osaka called for a trainer at the changeover. She briefly stretched out on the hardcourt before the decision was made.

The world No. 50 received treatment after the match and did not speak to reporters.

Pliskova, meanwhile, will play either sixth-seeded Carolina Wozniacki of Denmark in the next round.

Also Thursday, she teamed with Canada's Eugenie Bouchard,for a rollicking doubles match at the grandstand court. They pushed Germany's Anna-Lena Groenefeld and Kveta Peschke of the Czech Republic to the brink before dropping a 7-5, 1-6, 11-9 decision.

Bouchard/Pliskova fall in doubles match at Rogers Cup1:01

Caroline Garcia of France defeated American Catherine Bellis 6-4, 6-2 in the other early singles match.

Later Thursday, fifth-seeded Ukrainian Elina Svitolina defeated American Venus Williams 6-2, 6-1 and Spain's Garbine Muguruza dispatched Australian qualifier Ashleigh Barty 6-0, 3-6, 6-2.

In doubles play, Ottawa's Gabriela Dabrowski and Latvia's Jelena Ostapenko defeated Germany's Julia Goerges and Ukraine's Olga Savchuk 4-6, 6-2, 10-3. The top-seeded doubles team of Makarova and Russia's Elena Vesnina beat Bianca Andreescu of Mississauga, Ont., and Montreal-based Carson Branstine 6-1, 6-1.

Play continues at the $2.74 million US tournament through Sunday.