McNair got them on their way with a fine finish in the ninth minute before Jonny Evans doubled the advantage midway through the opening period.
The impressive McNair scored a second five minutes prior to the break before the hosts set up a tense finale with two goals in as many minutes from Vladimir Darida and Alex Kral in the second half, but the away side saw out the win.
The visitors started with a spring in their step and powered into a ninth-minute lead.
Liam Boyce's pass from the left wing found McNair on the edge of the penalty area and the Middlesbrough midfielder took a touch past Ladislav Krejci before slotting into the bottom-right corner.
They deservedly doubled their advantage midway through the first half when Evans reacted quickly after a goalmouth scramble from a corner to scoop home his fourth international goal.
McNair then scored his second after 40 minutes, latching onto Steven Davis' throughball before rounding the onrushing Jiri Pavlenka and slotting into an empty net.
The hosts improved markedly after the restart and reduced the deficit with quick-fire goals in the 67th and 68th minutes.
First, Darida crashed an effort into the roof of the net from Zdenek Ondrasek's lay-off before Kral superbly whipped into the bottom corner from 18 yards after turning inside Craig Cathcart.
The resurgent hosts did most of the pressing in the closing stages – Ondrasek rightly seeing a goal ruled out in stoppage time after he had bundled the ball out of Michael McGovern's hands – but Northern Ireland ultimately held on for an impressive win on the road.
What does it mean? First-half blitz too much for hosts
O'Neill said this game could be good practice ahead of a potential Euro 2020 play-off and he will be delighted with the way his side went about their business inside the opening 45 minutes. He will be less pleased with the way they lost focus in the second half, allowing the Czech Republic to get back into the game courtesy of some sloppy defending.
McNair makes his mark
After scarcely featuring for Middlesbrough last season, the 24-year-old is very much back in favour this campaign, starting every game for the Championship side. That is bearing fruit for his country, with the former Manchester United man scoring two fine goals in what was a superb display at the heart of the Northern Ireland midfield.
Simic run ragged by visitors
Making just his second appearance for his country, Stefan Simic endured a game to forget. He was consistently out of position during a torrid opening 45 minutes and suffered the ignominy of being hauled off at the break.
Key Opta Facts
- Northern Ireland have won a friendly match away from home for the first time since August 2006 (v Finland).
- Northern Ireland scored three first-half goals in an away international for the first time since March 2000 when they beat Malta 3-0.
- 50 per cent of Jonny Evans' four goals for Northern Ireland have come against Czech Republic, also scoring against them in a World Cup qualifier in September 2017.
- McNair has netted three goals in his last four appearances for Northern Ireland after failing to score in his first 28 games for the national side.
- Ondrasek has been involved in three goals in his two matches for the Czech Republic (1 goal, 2 assists).
The Czech Republic round off their Euro 2020 qualifying campaign with Group A games against Kosovo and Bulgaria next month, while Northern Ireland face a daunting double-header against Netherlands and Germany.