Three goals in 14 minutes saw Mark Gisdol's side into the quarter-finals, while Hamburg left it late against Cologne and Kaiserslautern saw off Union Berlin
Three goals in 14 first-half minutes provided Markus Gisdol's men with a comfortable advantage in Gelsenkirchen.
Kai Herdling put Hoffenheim ahead in the 21st minute before Roberto Firmino took centre stage, laying on a goal for Kevin Volland and then finding the net himself.
Schalke, who sit fifth in the Bundesliga, pulled one back through Jefferson Farfan after 67 minutes but failed to set up a grandstand finale.
Elsewhere, an 84th-minute strike from Ivo Ilicevic spared Hamburg's blushes in a 2-1 win over Cologne.
Adam Matuszczyk cancelled out Maximilian Beister's impressive opener for Hamburg, but the Imtech Arena hosts were still able to claim victory thanks to Ilicevic's late intervention.
Kaiserslautern also qualified, winning 3-0 at Union Berlin.
Willi Orban, Simon Zoller and Marcel Gaus were on target for the side lying third in Germany's second tier.