Greek fans jeered at Merkel, but she had the last laugh, jumping to her feet in joy every time her team scored.
Meanwhile, German fans taunted the Greeks, chanting: "We paid for your tickets."
After the game, Merkel visited the German players in the locker room.
"She congratulated us and said that we played very well," said German forward Mesut Özil. "The rest of what she said will stay among us."
Although Germany dominated from the start, the Greek defense held strong for much of the first half. Lahm finally put his team in front by controlling the ball with his chest and dribbling toward the middle before sending a long-distance shot into the corner off the hand of Greek goalkeeper Michalis Sifakis.
The Greeks equalized when Samaras knocked the ball past German goalkeeper Manuel Neuer on a perfect cross from Dimitris Salpigidis.
Khedira volleyed in a cross from Jerome Boateng in the 61st, and Klose headed in a free kick from Özil in the 68th.
Reus made it 4-1 in the 74th, volleying a shot in off the underside of the crossbar after Sifakis had saved from Klose. Salpigidis added a consolation penalty for Greece in the 89th.
It was the 15th consecutive competitive victory for Germany, dating back to the win over Uruguay for third place at the 2010 World Cup. The Germans will face either England or Italy in the semifinals on Thursday in Warsaw.
Portugal loses Postiga. Portugal striker Helder Postiga will miss Wednesday's semifinal against France or Spain after injuring his right thigh in the 1-0 quarterfinal victory over the Czech Republic.
Americans tuning in. The average audience for Euro 2012 in the United States was up 82 percent from four years ago for broadcasts through the group stage.
The 24 matches on ESPN averaged more than one million viewers. For Euro 2008, the games were watched by an average of 552,000 people.