This was a vital win for Manchester City and for their manager Stuart Pearce in particular.
Pearce has been under terrific pressure in recent weeks with speculation that the former England defender could be sacked this weekend after a run of defeats.
Pearce, however, could have escaped a stay of execution with three points that ease relegation fears.
The final whistle was greeted with delight by City fans and players, with Joey Barton and Emile Mpenza throwing their shirts into the crowd.
Middlesbrough suffered only their second defeat since the turn of the year and that improvement will be required for the FA quarter-final replay against Manchester United, at Old Trafford on Monday night.
Manager Gareth Southgate made changes with the Cup-tie in view, leaving out Jonathan Woodgate and Julio Arca and relegating Mark Viduka to the bench.
This was Middlesbrough's most disappointing performance for several weeks and they could not really complain over the result.
Southgate will certainly hope for more passion, and more flair, if his team are to pull off a shock at Old Trafford and reach the semi-finals.
Pearce patrolled the technical area from the start, urging his players on. He must have been a relieved manager at the final whistle.
Middlesbrough suffered an early blow when defender Emanuel Pogatetz was carried off on a stretcher after falling to the ground without being involved with another player.
Shortly afterwards City lost Micah Richards. He limped off and could be a serious doubt for England's match in Israel next weekend.
The quality of football in the first half was disappointing with neither goalkeeper under a great deal of pressure and there was some booing by some sections of the crowd at the half-time whistle.
French defender Sylvain Distin threw City a lifeline after 61 minutes when he shot in from six yards, following a Barton corner on the left.
Middlesbrough sent on Viduka shortly after in a bid to revive the fortunes of the team, but it was the visitors who were celebrating a goal ten minutes later.
Recent signing Mpenza scored after Lee Cattermole lost possession.
Mpenza showed his delight by jumping into the crowd to celebrate and was promptly booked by the referee.