However the win came at a price with key trio Kyle Lafferty, Steven Davis and Grant McCann all booked and ruled out the crucial home fixture against Poland next month.
That was the only downside on a good night for the province and a special one for Gareth McAuley and Chris Brunt, who both scored their first goals at this level.
Grant McCann was also on target as they moved into second place in Group Three on goal difference, although they have played a game more than their rivals.
It was almost like a home game for Northern Ireland with 1,300 supporters making the trip to this small corner of Italy.
Northern Ireland took the lead in the seventh minute and never let go of their grip on the game against a side that has never won a competitive game.
McAuley smashed a superb half volley into the net following a corner from McCann.
Stephen Craigan should have added a second in the 13th minute when he got clear of his marker when McCann delivered the corner only to scuff his effort wide of the target.
Northern Ireland kept up the momentum and Lafferty cracked in a shot in the 22nd minute that was blocked. But they did not have long to wait before extending their lead.
It was another fine strike as well with McCann rifling a shot into the corner from 18 yards after Martin Paterson's effort was blocked in the 32nd minute.
McCann must enjoy facing San Marino as the Scunthorpe midfielder scored earlier in the fixture in Belfast.
It was all going to plan for manager Nigel Worthington with the opposition looking short on confidence.
Damien Johnson, making his first appearance in 11 months, was revelling in the space given to him on the right wing.
He was putting San Marino under continual pressure with a string of good crosses.
Then Paterson tried his luck from 20 yards in the 39th minute but his effort cleared the bar.
Northern Ireland kept up the pressure and David Healy's effort four minutes later was parried to safety by the goalkeeper before Craigan sent a shot wide.
Worthington made his first change in the 55th minute, bringing on Brunt for Lafferty.
McCann almost added a third goal for Northern Ireland six minutes later, his inswinging free-kick hitting the top of the bar.
Brunt made an immediate impact and put the province 3-0 ahead in the 63rd minute, driving in a a 25-yard free kick that went under the hapless goalkeeper's body.
It was becoming a rout and Healy then skipped away down the right. He picked out McCann, who had taken up a good position, only for his effort to be blocked.
San Marino were reduced to 10 men in the 70th minute when Manuel Marani was sent off after picking up a second yellow card.
Northern Ireland continued to pour forward in a bid to add to their goal tally but the home side held firm.
However the result was just the boost manager Worthington was looking for with a string of difficult fixtures still to come and their hopes of qualifying are still alive.