Hungary earned their fourth Group E victory to close to within three points of second-placed Sweden, albeit having played a game more.
Goals either side of the break from Zoltán Lipták and Imre Szabics gave the visitors a comfortable lead before Vladimir Koman's deflected strike seven minutes from time sealed the win and moved Hungary on to 12 points from seven matches.
Sándor Egervári's team controlled the game from the very beginning and were almost ahead after nine minutes, Krisztián Németh's effort coming back off the frame of the goal. The 22-year-old was denied again midway through the first half, Aldo Simoncini this time on hand to keep the scores level.
The breakthrough finally came five minutes before the break, Balázs Dzsudzsák's corner falling to Lipták, who slotted past Simoncini to give his side the lead. Hungary did not have to wait long for their second, Szabics heading in Dzsudzsák's 49th-minute cross to double their advantage.
San Marino almost earned themselves a route back into the game but Matteo Vitaioli failed to find the target from Alessandro Della Valle's delightful cross. Victory was secured with seven minutes left, though, Koman's powerful 35-metre strike deflecting off Della Valle and past Simoncini.
Both teams return to UEFA EURO 2012 qualifying action on 2 September, with Egervári's side hosting Sweden and San Marino travelling to the Netherlands.
©UEFA.com 1998-2015. All rights reserved.