Federer had a tough second set against Berdych
Roger Federer beat Czech Tomas Berdych 6-3 7-6 (7-4) to book his place in the quarter-finals of the men's singles tennis in Beijing.
It was heavy going at times for the Swiss but the win avenged Federer's defeat by Berdych at the 2004 Olympics.
Rafael Nadal defeated Russian Igor Andreev 6-4 6-2, while third seed Novak Djokovic downed Russia's Mikhail Youzhny 7-6 (7-3) 6-3.
"My feeling is to try to play my best. I'm close to that," said Nadal.
Athens bronze-medallist Fernando Gonzalez and Paul Henri-Mathieu of France also came through against Olivier Rochus and Nicolas Kiefer respectively.
Nadal, Federer and Djokovic are all bidding to become the first top-five player to win the men's singles title.
Federer will face James Blake in the quarters after the American beat Gilles Simon 6-4 6-2, while Djokovic will play France's Gael Monfils, who beat Argentina's seventh seed David Nalbandian 6-4 6-4.
Nadal will meet Jurgen Melzer in the last eight after the Austrian ended the giant-killing run of Taiwan's Lu Yen-Hsun with a 6-2 6-4 victory.
In the women's singles, Venus Williams reached the quarter-finals by beating Victoria Azarenka of Belarus 6-3 6-2.
Williams is now through to the last eight after beating Azarenka
Williams, seeded seventh, is seeking to add to her medal collection after winning the singles and doubles at Sydney in 2000.
"I love the atmosphere," said Williams. "I think the most important part (about the Olympics) is it's only every four years, so now is the time to really play well.
"Quarter-finals now, so it's coming closer every round. It's my dream."
The American will meet Li Na in the last eight after the Chinese number two triumphed over Estonia's Kaia Kanepi 4-6 6-2 6-0 in the third round.
Later in the day America's Serena Williams edged out France's Alize Cornet 3-6 6-3 6-4 .
Meanwhile, top seed Jelena Jankovic of Serbia dispatched Dominika Cibulkova of Slovakia with a 7-5 6-1 win.
In other matches, Austrian Sybille Bammer set up a quarter-final clash with Russian ninth seed Vera Zvonareva after seeing off Czech Lucie Safarova 7-5 6-4.
Zvonareva battled past Italy's Francesca Schiavone 7-6 (7/4) 6-4.
Another Russian through to the last eight was in-form sixth seed Dinara Safina, who outmuscled China's number one Zheng Jie 6-4 6-3.
And Russia's Elena Dementieva knocked out Caroline Wozniacki of Denmark 7-6 (3/0) 6-2.