The Germany midfielder fired home a 71st-minute winner finally to kill off battling Boro, who had dragged themselves back into the game when Alvaro Negredo cancelled out Alexis Sanchez’s first-half free-kick five minutes after the restart.
The triumph – the Gunners’ first league away win for three months – lifted Arsene Wenger’s men seven points behind fourth-placed Manchester City, with a game in hand.
However, the visitors had to fight all the way in front of a crowd of 31,298 at the Riverside, with Boro making up for what they may lack in quality with a committed display, which for long periods looked like earning them tangible reward.
They kicked off knowing another failure to win – they have not managed a league victory since December 17 – would represent a major blow to their dwindling survival hopes, although buoyed by the knowledge that Arsenal had not collected three points on the road since they won at Swansea on January 14.
Equally, the visitors could not afford to allow that record to continue if they were to stand any chance of securing a 20th consecutive Champions League berth, although the vastly differing levels of ambition were not apparent for much of the first half.
The deadlock was broken three minutes before the break when, after Granit Xhaka had been felled by Adam Clayton 20 yards out, Sanchez curled the resulting free-kick past static Brad Guzan to give his side the lead.
Boro resumed in determined fashion with Stewart Downing lining up on the right, enjoying early success, and he picked out Negredo’s 50th-minute run into the box for the Spaniard to stab home an equaliser.
However, Arsenal restored their advantage with 19 minutes remaining when Aaron Ramsey laid off Sanchez’s cross for Ozil, who had been enduring a quiet evening up to then, to fire past the helpless Guzan.
Middlesbrough: Guzan, Barragan, Ayala, Gibson, Da Silva (Friend 17), Clayton, de Roon (Gestede 79), Leadbitter, Downing, Negredo, Ramirez (Traore 68). Unused substitutes: Konstantopoulos, Bernardo, Bamford, Forshaw.
Arsenal: Cech, Gabriel, Koscielny, Holding, Oxlade-Chamberlain, Ramsey, Xhaka, Monreal, Ozil (Bellerin 90), Sanchez (Coquelin 90), Giroud. Unused substitutes: Gibbs, Walcott, Iwobi, Martinez, Elneny.
Referee: Anthony Taylor (Cheshire).