BEIJING — Perhaps Roger Federer's not washed up yet.

Signaling his recent tailspin may be over, Federer avenged a defeat four years ago at the Olympics by beating Tomas Berdych of the Czech Republic 6-3, 7-6 (4) Wednesday to reach the quarterfinals.

It was Federer's biggest victory since he lost to Rafael Nadal in an epic Wimbledon final last month.

Federer wept after losing to Berdych in the second round at the Athens Games in 2004. This time he was shouting "Yes!" and punching the air after he smacked a service winner on match point to finish off Berdych.

"He's always dangerous," Federer said. "I just tried to play tough and compact and not give him much."

Nadal also advanced, digging out of a hole in a pivotal service game and beating Igor Andreev of Russia, 6-4, 6-2. Venus and Serena Williams won to remain on course for a sibling showdown in the women's final Saturday.

Nadal and Federer could meet for the gold medal Sunday. Regardless of the tournament outcome, Nadal is assured of climbing to No. 1 in the rankings next week, ending Federer's 4 1/2-year reign.

Federer will next face No. 8 James Blake, who advanced by beating No. 10 Gilles Simon of France 6-4, 6-2. Blake, the lone U.S. male to survive the first round of singles, is 0-8 against Federer and has won only one of their 22 sets.

"If he's too good for me, he's too good for me," Blake said. "Every time at the beginning of each match, I've felt like I could come out on top."

No. 3 Novak Djokovic, who could face Nadal in the semifinals, beat No. 13 Mikhail Youzhny of Russia 7-6 (3), 6-3.

No. 4 Serena Williams busted a racket in frustration over a slow start, then rallied to beat 18-year-old Alize Cornet of France 3-6, 6-3, 6-4.

Williams' outburst came as she fell behind 5-1 in the first set. She gradually tamed her erratic groundstrokes, and after managing a service break in the opening game of the final set, she held in five consecutive games for the victory.

Venus Williams, playing her first tournament since winning Wimbledon for the fifth time, also reached the final eight by defeating No. 12 Victoria Azarenka of Belarus 6-3, 6-2. Venus, seeded seventh, is seeking to add to her Olympic medal collection after winning the doubles with her sister and the singles at Sydney in 2000.

"It's only every four years, so now is the time to really play well," she said.

Jelena Jankovic of Serbia, who this week achieved the No. 1 ranking for the first time, beat No. 16 Dominika Cibulkova of Slovakia 7-5, 6-1. Jankovic's next opponent will be No. 6 Dinara Safina of Russia, riding a 13-match winning streak after beating Zheng Jie of China 6-4, 6-3.

When Federer broke for a 4-2 lead in the first set and let out a guttural "hmmmpf," he sounded as though he was lifting a heavy load off his shoulders. Which is exactly what he's trying to do in Beijing.

The stylish Swiss seeks his first medal after getting shut out at Sydney and Athens. He's also trying to end a slump that has left him without a major title this year, stalling his career total at 12, two shy of Pete Sampras' record.

Federer hit three aces in the final game of the first set, but his serve briefly went haywire two games later. He had three double-faults — more than he often hits in an entire match — and fell behind 3-0.

But those were his only double-faults, and he otherwise served well, breaking back in the fifth game and holding the rest of the way. In the tiebreaker he rallied from 3-1 down while hitting three service winners and his 11th ace.

Since losing to Berdych in Athens, Federer has beaten the Czech seven consecutive times while losing only one set.

Nadal played his third-round match on Court 1, which resembles a bull ring, and the Spaniard looked right at home as he wore down Andreev from the baseline. The 4,000-seat stadium was packed, and because of heavy haze the lights were on despite a 4 p.m. start.

Nadal broke for a 4-3 lead and served for the first set three games later. He fell behind love-40 and faced four break points in the game but overcame them all, with Andreev hitting a service return out each time.

In the second set, Nadal raced to a 4-0 lead. He closed out the match with a service winner, then punched the air in triumph.

"I am playing close to my best level," Nadal said. "My goal is try to continuing playing like this."