Bruno Alves put the visitors ahead on 21 minutes with a volley following Joao Moutinho's corner but Gareth McAuley headed NI level 15 minutes later from a Shane Ferguson corner.
Helder Postiga was then sent off just before the break and the hosts made Portugal pay when Jamie Ward scored from a corner soon after the restart.
But Chris Brunt was sent off for a second bookable offence and Portugal took advantage, with Ronaldo heading home goals on 68 and 77 minutes.
Substitute Kyle Lafferty was also given his marching orders on 80 minutes for a late challenge and Ronaldo completed his hat-trick three minutes later to make sure of the points and send his side back to the top of Group F, while NI remain in fourth.
Ronaldo, playing for the first time since Gareth Bale replaced him as the world's most expensive player, overtook Eusebio as his country's second-highest goalscorer on the night and now has 43 for Portugal.
Injuries to Aaron Hughes, Craig Cathcart and Ryan McGivern, as well as Daniel Lafferty's suspension, had left NI boss Michael O'Neill with limited options at full-back and MK Dons right-back Lee Hodson was handed the toughest task of his career in marking Ronaldo.
Ronaldo's early touches were roundly booed by the crowd, though it was hard not to admire a wonderful piece of trickery that saw him nutmeg fellow captain Steven Davis.
The first attempt on goal took 16 minutes, Alves heading Moutinho's free-kick just wide. The same pairing combined to better effect five minutes later, Moutinho's corner cleared to the edge of the area and Alves sending a soft cushioned volley through the crowd of bodies and into the bottom corner.
But the hosts came back into the game and their pressure paid dividends in the 36th minute, with McAuley heading his side level.
It came from the likeliest source - a Ferguson corner - but the execution from the West Brom defender was superb. He rose highest in a packed box and angled his header deftly towards the far post.
The buoyant home fans then had more to cheer just before the break as Postiga aimed an apparent headbutt in the direction of McAuley and was shown a straight red card.
Ronaldo was furious but received a caution of his own for dissent.
McAuley was having the night of his life and almost made it even more remarkable shortly after the restart.
Picking up the ball just inside the Portugal area he spotted Rui Patricio off his line and sent a deft lob a yard over the crossbar from long distance. It was an audacious moment even Ronaldo might have smiled at.
It was no surprise when Northern Ireland scored their second from another corner.
Ferguson was again the provider, whipping the ball into the danger area and finding Jonny Evans. His header was on target but Ward, effectively man-marking the goalkeeper, managed to scramble home from point-blank range. There were appeals for offside, but the goal stood.
The lead was less than 10 minutes old when Brunt's dismissal made it an even playing field, a clumsy challenge on Joao Pereira earning his second yellow.
The equaliser arrived from Moutinho's 68th minute corner. Ronaldo shook off the attentions of substitute Lafferty to power his header past Carroll and go level with Eusebio on 41.
There was even more elation from the away contingent after 77 minutes, when Fabio Coentrao's hanging cross picked out Ronaldo at the far post. He was, unforgiveably, unmarked and headed emphatically into the corner from close range.
Lafferty was next for an early bath, a senseless lunge at Pereira his sin, and the stage was set for Ronaldo.
He rifled home an 83rd-minute free-kick to secure the match ball and leave Bale with a timely reminder of the standards expected from the best in the world.