The defending champion had won 26 straight matches.
MELBOURNE, Australia (AP) -- Roger Federer was on his hands and knees, his racket gone after he tumbled chasing a shot.
All he could do was watch as Marat Safin tapped a gentle forehand into an open court to cap a thrilling 4 1/2-hour Australian Open semifinal and end the top-ranked Federer's 26-match winning streak.
Safin fended off a match point in the fourth set, then needed seven match points of his own before pulling off a 5-7, 6-4, 5-7, 7-6 (6), 9-7 upset of defending champion Federer and advancing to his third Australian Open final in four years.
"It's always going to hurt, no matter how great the match was," Federer said. "But at least you can leave the place feeling good about yourself, because I gave it all I had."
The women's final is set, featuring past champions Serena Williams and Lindsay Davenport. Williams' 2-6, 7-5, 8-6 victory over Maria Sharapova in a rematch of last year's Wimbledon final produced about as much drama as Federer-Safin.
Williams saved three match points, then leaped three times after ending it with a winner.
The top-ranked Davenport, who contemplated retiring in 2004, came back to beat No. 19 Nathalie Dechy of France 2-6, 7-6 (5), 6-4. Davenport also reached the doubles final, pairing with Corina Morariu to face Svetlana Kuznetsova and Alicia Molik for that title.
'Like a brain fight'
With Federer trailing 8-7 in the fifth set and serving on match point, he lunged to retrieve a deep shot wide to his forehand side. He swatted back a desperation shot, but slipped and dropped his racket. Safin converted the putaway.
"It's like a brain fight. It's more mental than physical against Roger," said Safin, who smashed his racket to the court two points before he lost the third set and later belted a ball into the stands.
The mercurial Russian, whose lone major title came at the 2000 U.S. Open, showed that it is possible to frustrate Federer. The Swiss won four of the previous six Slams, including three in 2004 -- the first man since Mats Wilander in 1988 to win a trio in a single season.
While Safin kept his temper in check just enough, Federer had some rare moments of anger, yelling at himself, screaming after a missing an attempted shot between legs on his only match point and later spiking his racket.
Federer needed treatment on his shoulder and elbow at the end of the fourth set and during the fifth. He said he had a tender nerve running down his arm to his fingers, but it was more a nuisance than a problem.
"It's really unfortunate. I thought I played really well under the circumstances. A point here and there changed the match," he said. "It's a pity. At least I gave it a fight."
The 15,222 fans at Rod Laver Arena raised their arms as if saluting an emperor when Federer walked off the court with one arm aloft for a final wave. The semifinal started on Thursday -- it was Safin's 25th birthday, and the crowd serenaded him -- and ended at 12:25 a.m. Friday local time.
Peter Lundgren, who was Federer's coach until late 2003 and linked up with Safin last season, wiped away tears after the match. He'd helped bring down Federer, who looked close to invincible when he breezed past four-time Australian Open winner Andre Agassi in the quarterfinals.
Federer didn't drop a set in five previous matches and had only served six double-faults. He'd reached that number of double-faults by the third set against Safin and finished with eight.
Federer last lost in August at the Olympics. This defeat also ended streaks of 24 straight wins against top 10 opponents and 19 in a row at majors.
"I'm not playing against just a simple player. He's No. 1 in the world," said Safin, who lost Australian Open finals to Thomas Johansson in 2002 and to Federer last year.
"It was one of the toughest matches of my life. I need time to recover," he added. "Five sets is a kind of lottery. Anything can happen."