Shelvey set Gouffran away towards goal in the 10th minute, and the forward was clumsily brought down by Birmingham goalkeeper Adam Legzdins.

Ritchie stepped up to stroke the resulting penalty past Legzdins.

The goal helped calm any nerves and settle Barlaser, Findlay and El-Mhanni into the game, while Shelvey got around the pitch and dictated play just as he had been doing before he was handed a five-game suspension for using racially-aggravated language.

Birmingham occasionally threatened when they did get the ball off Shelvey, and DeAndre Yedlin made an important interception to deny David Davis.

United needed a second goal before the break, and they got one.

Gouffran controlled a free-kick from Shelvey and volleyed it past Legzdins in the 34th minute.

Newcastle ended the half in total control, and the post denied Ritchie a second goal. Barlaser couldn’t get a proper connection on the rebound.

United took their two-goal advantage into the break and Benitez sent out an unchanged side for the second half. There was more of the same from Benitez’s side, who dominated possession.

Achraf Lazaar forced a save from Legzdins with one effort, while Ritchie was a threat whenever he got on the ball in the final third of the pitch.

But Birmingham, out of nowhere, got a goal.

David Cotterill set up a nervous finish with a strike with 19 minutes left on the clock.

All of a sudden, Newcastle looked nervous, and Benitez quickly sent on Isaac Hayden, injured in last weekend’s 2-1 win over Brentford, in place of DeAndre Yedlin.

Birmingham, finally, started to cause problems for a defence which had previously been comfortable.

The only problem was that they left gaps at the back as they pressed for an equaliser, and United were happy to hit them on the break with the pace of Ritchie.

Cheick Tiote left the field, possibly for the last time as a Newcastle player, late in the game to be replaced by Jack Colback.

Tiote – who, typically, had been booked for a clumsy challenge – was warmly applauded off the field.

The decisive third goal came in injury time when Shelvey delivered a low cross from the byline for Ritchie.