INDIAN WELLS   -     Roger Federer came out playing like his legendary self. Dominic Thiem needed a set to adjust to what he was seeing across the net.

Thiem went on to beat Federer 3-6, 6-3, 7-5 and win the BNP Paribas Open on Sunday, denying Federer a record sixth title in the desert. “It just feels unreal what happened,” Thiem said. “He’s such a legend.” Thiem trailed 4-3 and 5-4 in the third set before breaking Federer with a forehand winner to go up 6-5. Thiem served out the two-hour match that ended with yet another error from Federer, a forehand dumped into the net.

Federer was in the final for the third straight year and lost for the second year in a row. He was beaten in a third-set tiebreaker by Juan Martin del Potro last year. Federer won his 100th career title in Dubai recently. Thiem had lost in his previous two ATP Masters 1000 finals. But the 25-year-old Austrian’s solid serve held up against Federer as it had throughout the tournament. Thiem was broken just four times out of 61 service games in the tournament. He didn’t lose serve during his semifinal win over Milos Raonic, facing only one break point in that match.

Thiem and Andreescu earned $1.3 million each. Federer and Thiem had split their four previous meetings, but Federer had won both of their hard-court matches without dropping a set. He cruised through the first set in 36 minutes while getting broken for just the second time during his run to his ninth appearance in the final. But Federer broke back in the next game and served out the set. “The way he was playing the first set was unreal,” Thiem said. “I had to get used to it.”

Thiem earned the only break of the second set in the fourth game, going up 3-1. Federer won just two more games in the set. Both players were on serve in the third set until Thiem collected the only break. Federer tried consecutive drop shots that Thiem retrieved for crosscourt forehand winners before the Austrian hit a winning forehand to lead 6-5. “He did very well when he got up to the ball, stayed calm, made the shot,” Federer said.

Federer won just one point on Thiem’s serve in the final game. “Just came up against somebody who was on the day a bit better when it really mattered,” Federer said. “I have been in these positions so many times that I get over it very quickly.” Federer advanced to the final after rival Rafael Nadal withdrew before their semifinal match because of knee pain. Thiem also benefited from a walkover, reaching the semis when Gael Monfils withdrew with an Achilles injury.

 Canadian teenager Bianca Andreescu upset Angelique Kerber 6-4, 3-6, 6-4 to win the women’s title. Andreescu, an 18-year-old Canadian, became the first wild-card winner and second-youngest to claim the title in tournament history. “The fricking champion of Indian Wells,” Andreescu said. “It’s crazy.” She overcame nerves, fatigue, arm and leg issues in the final set to earn the first title of her fledgling career. Andreescu won on her fourth match point when Kerber netted a backhand. She broke Kerber three times in the third set, rallying from a 3-2 deficit to take four of the final five games.

Andreescu dropped her racket near the baseline and fell on her back, her legs in the air as she covered her face in disbelief. After getting up and exchanging kisses with Kerber, the teen bent down and kissed the sunbaked hard court and dropped to her back again, her arms and legs splayed, before grabbing her head. Born in Canada, she later moved with her parents to Romania, where she first started playing tennis.

Kerber was the last of five seeded players that Andreescu knocked off in her seven matches. “When she had the chances, she just go for it,” Kerber said. The Canadian followed in the footsteps of Naomi Osaka, who was a little-known 20-year-old when she won the title last year. Osaka used it as a springboard to win titles at the U.S. and Australian opens while ascending to the No. 1 ranking in January. “No pressure,” Andreescu said, joking.

She’s projected to rise 36 spots to No. 24 in the WTA Tour rankings on Monday. Kerber, ranked eighth, remains without a title since winning Wimbledon last year. She was a crowd favorite, with fans waving Canadian flags and chanting “Let’s go, Bianca! Let’s go” in the second set. They clearly enjoyed Andreescu’s fearless style of play. She alternately outpunched opponents from the baseline, tossed up high-arching shots and unleashed well-time drop shots — usually during the same point.

A smiling Andreescu was quick to correct a reporter. “It’s not moonballing,” she said. “It’s just hitting heavy to her backhand with more spin. We’re not under 12 here.” Her most dominant win during the 12-day tournament came in the quarterfinals, a 6-0, 6-1 rout of two-time major champion Garbine Muguruza. In all, the teen knocked out four Top 20 players.

Leading 2-1 in the third, Andreescu took a medical timeout and had a trainer massage her tight right shoulder and arm. Kerber won the next two games, breaking Andreescu to go up 3-2. Appearing tired and nervous, Andreescu called for her coach, who urged her to make Kerber play every point. She did just that. Andreescu won the next three games, ripping off powerful forehands while winning nine straight points during one stretch, including a 40-love service game. “I just fought till the end because physically I wasn’t feeling too well,” she said.