Hamilton clocked 1 minute 20.953 seconds to put .413 seconds between himself and Lotus driver Grosjean, who achieved his first front-row start of the season for Sunday's race.
Red Bull's Vettel finished in 1:21.416, just ahead of Hamilton's teammate Jenson Button.
"It's been a really positive weekend so far," said Hamilton, who was fastest in Friday's two practice sessions and second behind Mark Webber of Red Bull in Saturday's morning practice. "Still, we have a very long race tomorrow so lots can happen, but we just need to keep our cool."
It was the third pole of the season and third pole at the Hungaroring, too, for Hamilton, who has one victory in 2012 and is fifth in the standings.
"It's the same as everyone else when they win races," Hamilton said when asked about the secrets to his success in Hungary. "You just have to keep your head cool and make sure you look after your tires. Tire strategy is going to be important."
It was the 150th pole position for McLaren, which contested its first Formula One race in 1966. The team has dominated at the Hungaroring in recent years, winning five of the last seven events.
Hamilton triumphed here in 2007 and 2009, while Button — who won his first race here in 2005 while racing for Honda — is the defending champion on the famously winding Hungarian circuit, where passing is difficult.
World championship leader Fernando Alonso of Ferrari was sixth, behind Lotus driver Kimi Raikkonen.
"We were expecting a very difficult qualifying and so it was," said Alonso, winner of two of the last three races. "All things considered, sixth place is not to be sneered at, far from it. It's true that overtaking is not easy here, but tomorrow it might rain and we know that can change everything."
Rounding out the top ten on the starting grid were Ferrari's Felipe Massa, the Williams duo of Pastor Maldonado and Bruno Senna, and Nico Hulkenberg of Force India.
Alonso has 154 points after 10 of 20 races, 34 ahead of Webber, who will start from 11th place. Vettel is 44 points behind the Ferrari driver.
Grosjean, a Formula One newcomer, was thrilled about beating Vettel for second place on the grid just as the checkered flag came down to mark the end of qualifying.
"Being here on the front row is something special ... we know overtaking is very difficult," Grosjean said. "'We'll need to start from the front,' we've said that for a long time, so first job done."
Vettel, the two-time defending champion, was confident about achieving a good result on Sunday.
"With the progress we made since this morning and through qualifying, I think we should be in a good position tomorrow for the race," Vettel said. "The car is quick and sometimes really quick but it's a bit difficult to get it out of the car all the time."
Michael Schumacher, a four-time winner in Hungary, had a disappointing run in his Mercedes and will start from 17th place, his second-worst qualifying spot so far this season.
Sunday's race at the Hungaroring leads into a monthlong summer break before the Belgian Grand Prix on Sept. 2.