Djokovic beat Stanislas Wawrinka 6-1, 6-4 on Friday, and Federer overcame Juan Martin del Potro 6-3, 4-6, 6-3.
Top-ranked Rafael Nadal also moved into the semifinals with a 6-4, 6-1 victory over Richard Gasquet. Nadal will face defending champion David Ferrer, a 4-6, 7-5, 6-3 winner over Tomas Berdych.
The last time Federer beat a top-10 player was when he outlasted Jo-Wilfried Tsonga in the Australian Open quarterfinals.
''That's definitely good for my confidence, because those are the kind of wins I need right now,'' Federer said. ''I'm happy now I won against a top-10 again, especially just before London where I will have to play against three top-10 players in a row.''
Federer avenged a loss last weekend to del Potro in the Swiss Indoors final. The 17-time Grand Slam champion played nearly flawless tennis in the first set, making 17 winners and only four unforced errors.
Del Potro fought back in the second set, saving a break point in the opening game before converting his second break chance at 5-4 to level the match when the fifth-seeded Federer netted a forehand.
In the deciding set, del Potro sent a forehand into the net to drop serve at 3-3 and Federer won the match when the Argentine hit a forehand long.
Djokovic, who saved all six break points he faced, won 13 of 19 points at the net.
''Coming to the net is one of the improvements that I had recently,'' the second-seeded Serb said. ''It didn't click so fast, trust me. I had to work and put in many, many hours on the practice court that you guys don't see.''
Wawrinka lost five-setters against Djokovic at the Australian Open and the U.S. Open this year.
''When he plays that good it's very difficult, especially on this surface where he's the best, I believe,'' Wawrinka said.
Nadal improved his record against Gasquet to 12-0 despite a crowd cheering loudly for the only Frenchman left in the draw.
The Spaniard, who is seeking a record sixth Masters title in a single season, broke for a 4-3 lead with a crosscourt backhand return winner.
Gasquet struggled with his one-handed backhand against Nadal's powerful groundstrokes and the U.S. Open champion went a set up when the Frenchman made a backhand error.
Nadal took a 4-0 lead in the second set and finished off Gasquet by whipping a forehand winner down the line.
''Winning a match against him before the end of my career is going to be extremely difficult,'' Gasquet said. ''I would like to, but he's getting better and better.''
Nadal is 32-2 on hard courts this season after he was sidelined much of last year with a knee injury.
''Probably the injury that I had (forced) me to play more aggressive than before, and that helped me a lot to play better on hard,'' Nadal said.
Nadal unseated Djokovic atop the rankings by reaching the final of the China Open last month.
The eight quarterfinalists are in the eight-man ATP World Tour Finals next week in London.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)