Djokovic had his serve broken twice early on before recovering and sealing the win. The victory improved his record against Baghdatis to 6-0, and raised his 2011 record to 67-3.
"I started slowly, no life on the court, and he took his chances," said Djokovic, playing his first tournament after a six-week break to heal a back injury. "My body is still getting used to this competition mode. I have to stay patient."
The U.S. Open, Wimbledon and Australian Open champion will play 32nd-ranked Kei Nishikori of Japan in Saturday's semifinals. Nishikori beat Mikhail Kukushkin of Kazakhstan, 6-4, 5-7, 6-4 in a match that featured 13 breaks of serve.
In beating Roddick at Basel for the fourth time, Federer improved to 21-2 against the 2003 U.S. Open winner. He cruised after breaking Roddick's serve to lead 5-3 in the first set.
"It's great to get those big momentum shifts going sometimes. It was a good performance from my side," said Federer, also returning after six weeks off.
Roddick's paycheck this week raised his career tournament earnings over $20 million.
Djokovic, who came to Basel having not played since Sept. 18, was pushed to three sets for the second time in three matches.
"It's nothing I didn't expect, but I'm winning matches and that is what matters most," Djokovic said.
The 59th-ranked Baghdatis dominated the first set, as he broke the top-seeded Djokovic's serve and struck six aces.
Djokovic broke through for a 4-2 lead in the second after the Cypriot double-faulted.
Djokovic dominated the rest of the match, sealing the victory in exactly one hour less than Nishikori's two-hour, 39-minute effort.
Neither Nishikori nor 113th-ranked Kukushkin could land half of their first serves, however the 21-year-old Japanese took his first match-point chance with just his second ace.
With his three victories in Basel, Nishikori will rise to a career-best ranking. He had been No. 30 after reaching the Shanghai Masters semifinals last month.
"It's a great feeling. A great experience for me," said Nishikori, who lost his only meeting with Djokovic at the 2010 French Open. "(Novak) is playing on a different level. I am going to try to be more aggressive than usual."