TORONTO — Bianca Andreescu became the first Canadian to win the Rogers Cup in 50 years when Serena Williams retired because of an injury on Sunday.

Andreescu was up 3-1 in the first set when Williams called for a medical timeout.

Less than a minute later, the chair umpire announced that Williams was retiring from the match, handing Andreescu her second WTA Premier title of the season.

The tournament’s final lasted only 16 minutes before Williams withdrew.

“It started yesterday in my match. It just got worse,” Williams said after Sunday’s match. “My whole back just spasmed to the point where I couldn’t sleep and I couldn’t really move.”

The US Open begins at Flushing Meadows two weeks from Monday.

After the chair umpire announced Williams’ retirement, the former world No. 1 started to cry on her bench. Andreescu went over to comfort her, hugging her and telling Williams how much she admires the 23-time Grand Slam winner.

“I’m not a crier, but, thank you guys,” said Williams as she choked back tears after accepting the second-place check. “I’m sorry I couldn’t do it today. I tried but I just couldn’t do it.”

Williams’ retirement was the last of several high-profile injuries at this year’s Rogers Cup. Fourth-seeded Simona Halep withdrew from her quarterfinal matchup with Marie Bouzkova. On the men’s side, Milos Raonic retired after two sets against Felix Auger-Aliassime in a much-anticipated all-Canadian matchup. No. 16 seed Gael Monfils then withdrew before his semifinal against world No. 1 Rafael Nadal.

The 19-year-old Andreescu, from nearby Mississauga, Ontario, has victories over seven of the top 10 players in the world. Her world ranking will rise from 27th to 14th on Monday. Her previous high was 22nd.

“I’m speechless right now. I’m the first Canadian who got to the finals and has won this tournament since 1969,” Andreescu said after being presented with the Rogers Cup trophy in an on-court ceremony. “This been a dream come true, really.

“This week has not been easy. I’ve had many, many tough matches.”

The Rogers Cup was Andreescu’s first tournament after a right-shoulder injury sidelined her since the French Open in May.

“What I’ve been through the past two months has not been easy,” Andreescu said when addressing fans. “I kept telling myself ‘never give up.’ I’m trying to look at my injury not as a setback but more of a challenge. I tried to embrace it as much as I can.”

Andreescu had been on the court more than any other player at this year’s Rogers Cup at 10 hours, 54 minutes heading into the match against Williams.

Faye Urban of Windsor, Ontario, beat Vancouver’s Vicki Berner in the 1969 final, when the tournament was still played on clay courts and called the Canadian Open.