Germany will face either Italy or Spain in the quarters.
Germany coach Joachim Low said, "I'm sleeping well. Both Italy and Spain are favorites. Italy are incredibly strong in defense."
"I think in any case we have to improve if we want to win the tournament," Low added.
Only eight minutes into the game, a corner for Germany was cleared only to the top of the box, and the centre-back Jerome Boateng stroke a volley that sailed towards the bottom corner past the hand of Slovakia keeper Matus Kozacik.
Low said, "Boateng scored an important goal. I was happy his calf had been all right yesterday. In today's game, he did not lose his defense."
Four minutes later, German forward Mario Gomez was pushed to the ground in the box by Slovakia central defender Milan Skrtel, and the referee pointed to the spot.
Kozacik guessed correctly, diving to his left to palm away the penalty from Arsenal midfielder Mesut Ozil.
In the 43rd minute, German winger Julian Draxler made an Okocha-style dribble on left flank, dancing past a defender and delivering a pinpoint cross to the goal mouth. Gomez stuck out his boot at the front post to convert the cross.
Wolfsburg winger Draxler shone again in the 63rd minute with a close-range volley to seal the win.
Slovakia coach Jan Kozak said, "The German team maybe have a slow start in the group stage but show clear cut chances against Iceland. They started the composition today and controlled the match. I think they deserved to win."
"The first goal was the result of the play until that moment. We gave too much space for them to link up play. They played with great determination. I think we played with a little fear," Kozak added.
Draxler was voted the Man of the Match.
"We deserve the victory. It is nice to be in the front. I am motivated," Draxler said.
Slovakia had beaten Germany 3-1 in a friendly at the end of May. But they were underdogs in this duel, almost giving up in the last 15 minutes.
Low made a crucial change to his side as Draxler replaced Mario Gotze. Gomez led the attacking line once again, while Joshua Kimmich continued at right-back.
Draxler said, "I didn't play the last two games, but it is not a problem. We have a lot of quality. And I am happy to help the team."
For Slovakia, Milan Skriniar and Norbert Gyomber made their first starts at Euro 2016, with Michal Duris and Patrik Hrosovsky also being handed a place in the starting lineup by Kozak.
Statistics showed that Germany enjoyed 61 percent ball possession, 8 attempts, 7 on target and 589 total passes, while Slovakia made 5 shots, 2 on target and 390 passes.
It was a lop-sided game as Slovakia's defense looked desperate in Germany's consistent movements and passes.