MELBOURNE, Australia — Top-ranked Ash Barty built a big lead in her quarterfinal match at the Australian Open before her opponent took an injury timeout and left the court.

More than an hour later, it was Barty heading abruptly out the exit. She was upset Wednesday by Karolina Muchova 1-6, 6-3, 6-2.

Seeded No. 25, Muchova earned her first semifinal berth in a Grand Slam. Her comeback win ended Barty’s bid to become the first Australian woman to win the title in Melbourne since Chris O’Neil in 1978.

“It’s heartbreaking, of course,” Barty said. “But the sun will come up tomorrow. You’re either winning or you’re learning, and today is a massive learning curve for me.”

Muchova’s opponent Thursday will be No. 22-seeded Jennifer Brady, who rallied to beat unseeded Jessica Pegula 4-6, 6-2, 6-1 in an all-American matchup.

Muchova played poorly at the start of her second major quarterfinal, and Barty raced to a 5-0 lead while losing only six points. After nine games, Muchova had one winner and 18 unforced errors, and early in the second set, she took an injury timeout that lasted nearly 10 minutes.

“I started feeling a bit lost,” Muchova said. “Ash started very good. She played almost like no mistakes; it was very tough. I was a bit lost on the court and my head was spinning, so I took a break. And it helped me.”

Medical personnel took her temperature, checked her blood pressure and gave her ice before she left the court. When the Czech returned, she played much better.

“I tried to play a bit faster rallies so we don’t play long ones as in the first set,” Muchova said, “and it worked well.”

Barty had no complaints about Muchova’s reason for halting play.

“It’s within the rules,” Barty said. “She’s within her rights to take that time. That shouldn’t be a massive turning point in the match. I’m disappointed I let that be a turning point.”

Comebacks have been a staple in the tournament for Muchova, who rallied in earlier matches to win sets after trailing 5-0 and 4-0.

Against Barty, she began moving into the court to hit her groundstrokes earlier. Barty, pushed behind the baseline, became indecisive and erratic.

During one stretch, Muchova won eight of nine games. Barty finished with 37 unforced errors and lost serve four times in the final two sets.

“I just overplayed,” Barty said. “I just pressed a little bit too much and gave up too many cheap errors at some pretty critical times.”

Muchova’s only other victory over a top-five opponent was against No. 3 Karolina Pliskova at Wimbledon in 2019.

The Associated Press contributed to this report.