KEY BISCAYNE: Roger Federer’s run at the Miami Open was one point from ending. Down 6-4 in a third-set tiebreaker to Tomas Berdych, the situation was officially dire.

Yet even in that moment, Federer still felt some hope.

ā€œI had belief I could turn it around, even then,ā€ he said.

Somehow, he was right, and his stellar start to 2017 continued. The fourth-seeded Federer fought off those two match points and beat the 10th-seeded Berdych 6-2, 3-6, 7-6 (6) in the quarterfinals on Thursday — avenging a third-set tiebreak loss to Berdych at Key Biscayne seven years ago in a match he still thinks he should have won.

ā€œI got incredibly lucky,ā€ Federer said. ā€œCould have gone either way. Felt like maybe this one I should have lost.ā€

Federer feels right at home at Key Biscayne, and so does Caroline Wozniacki — with good reason, since she sometimes practices at the facility. The 12th-seeded Wozniacki, a part-time South Florida resident, made the women’s final for the first time in 10 tries by topping second-seeded Karolina Pliskova 5-7, 6-1, 6-1.

Wozniacki will play No. 10 Johanna Konta in Saturday’s championship match. Konta topped No. 11 Venus Williams 6-4, 7-5 in the second semifinal, one that ended just after midnight.

ā€œThis is one of the few tournaments where I’ve never made a finals,ā€ Wozniacki said. ā€œI think my best result here was semifinals five years ago. It’s always been a tournament where I wouldn’t say I struggle, but I’ve just not had the results I wanted.ā€

Federer improved to 17-1 this year and will face No. 12 Nick Kyrgios in the semifinals on Friday.

Kyrgios defeated 16th-seeded Alexander Zverev 6-4, 6-7 (9), 6-3 in the last of the men’s quarters, a match that lasted 2 1/2 hours. Kyrgios had 16 aces, no double faults and never faced a break point, though his 19-year-old opponent saved five match points before falling.

Zverev fought off three match points in the second-set tiebreaker, and won the set when Kyrgios — who pulled off two between-the-legs shots on the same point in the first set — tried another that didn’t work.

ā€œI don’t know what I was thinking,ā€ Kyrgios said.

He recovered and gets to face Federer, whom he called ā€œthe greatest of all time ... my favorite tennis player.ā€ Federer-Kyrgios is a rematch — sort of — from this year’s quarterfinals at Indian Wells, a match where Kyrgios withdrew beforehand with an illness.

Rafael Nadal and Fabio Fognini are the other men’s semifinalists, meaning there’s still a chance for Federer-Nadal on Sunday for the men’s crown.

ā€œI would love it,ā€ Federer said.

Federer is now 4-0 in tiebreakers this year at Key Biscayne, none of the first three as pressure-packed as the one he needed in the quarters. He was serving for the match at 5-3 in the third and got broken, had a match point in the next game and couldn’t convert, then was down 6-4 in the breaker before winning the final four points.

Berdych actually won 91 points to Federer’s 89. He needed 92 — and after coming up with big shot after big shot in the final two sets, he wound up going out on a double-fault.

ā€œI just lost by one point. That’s what happened. Very simple, very straightforward,ā€ Berdych said. ā€œHe was the one serving out the match, didn’t make it. I had a match point, didn’t make it. I had two, didn’t make it. So what else to say?ā€œ

Like Federer, Wozniacki rallied, albeit with far less drama. She won 12 of the last 14 games.

ā€œI got a good start to the second set and that kind of got me fired up,ā€ Wozniacki said.

This will be the second consecutive time two double-digit seeds make the women’s final at Key Biscayne, after No. 13 Victoria Azarenka beat No. 15 Svetlana Kuznetsova a year ago. Konta was down 3-1 in the second set, and wound up breaking Williams five times — in a staggering 17 chances.

Williams was bidding for her fourth Key Biscayne title, the last of which came 16 years ago.

ā€œI’m going to have a tough battle on my hands,ā€ said Konta, is assured of returning to the top 10 in the world rankings regardless of Saturday’s result. ā€œCaroline, she makes you work for every single point.ā€