Manchester United moved up to fifth in the Premier League as Middlesbrough's first game since sacking manager Aitor Karanka ended in defeat.
Ashley Young's deep cross found Marouane Fellaini at the back post to head past Victor Valdes, before Jesse Lingard's terrific strike doubled United's lead after the break.
Boro, with caretaker boss Steve Agnew in charge, were invited to apply pressure and when Chris Smalling made a mess of an easy clearance in the box, substitute Rudy Gestede pounced.
But former United keeper Valdes slipped in stoppage time and Antonio Valencia's tap-in secured the three points.
Jose Mourinho's side leapfrog Arsenal and Everton into fifth, while Middlesbrough remain 19th in the table and are five points from safety.
Having parted ways with Karanka on Thursday, Middlesbrough chairman Steve Gibson charged Agnew with helping the Riverside club avoid the drop.
But the former assistant manager was unable to inspire his side to a fifth Premier League win this season despite dominating possession for large periods of the game.
Alvaro Negredo looked isolated up front before Agnew introduced Gestede on 67 minutes, and with two in attack Boro looked capable of drawing level.
But United, showing seven changes from their Europa League win over FC Rostov in midweek, ground out a tricky three points.