The victory, Arsenal’s sixth in a row, lifts the Gunners up to second – level on points with leaders Manchester City – but they were made to work hard by a Swansea side under the management of Bob Bradley for the first time.
Arsene Wenger’s team made their intentions clear after just four minutes, with Ozil breaking clear in the box but his shot was well blocked. Ozil then nearly turned provider when his corner was headed on to the bar by Shkodran Mustafi.
There was precious little for Swansea at the other end, though the in-form Leroy Fer – who has four goals already this season – sent a rising drive just over the crossbar.
Arsenal took the lead just before the half hour when Hector Bellerin headed the ball into the six-yard box and Walcott stole in ahead of his marker to scramble home from close range.
Three minutes later a sweeping counter involving Ozil and Alexis Sanchez saw Bellerin’s goalbound effort well saved by Lukas Fabianski.
From the resulting corner the Swans failed to clear their lines, allowing Walcott to spin on the edge of the six-yard box and fire home his fifth goal in as many games.
The Gunners were comfortable at that stage but allowed the visitors back into the game when Xhaka gave the ball away on the edge of the area, straight to Gylfi Sigurdsson, who curled the ball into the top corner.
Arsenal extended their lead early in the second period when Sanchez crossed to Ozil at the far post and the German volleyed the ball into the roof of the net.
Most observers would have expected Arsenal to ease to victory from then on, but Swansea hit back when Modou Barrow pulled the ball back for substitute Borja Baston to sweep home his first goal for Swansea.
Arsenal were then reduced to 10 men when Xhaka was shown a straight red card for a crude trip on Barrow.
The Gunners were rocking at this stage and were lucky to survive when Barrow headed straight at Petr Cech when unmarked in the box.
As Swansea piled forward spaces opened up at the over end, with Walcott hitting the inside of the post and then the crossbar as he chased a hat-trick.
There was a palpable sense of relief around the Emirates at the final whistle while Swansea and new boss Bradley will take heart from another battling performance.
Newcastle United are reportedly weighing up a summer offer for Sevilla midfielder Alejandro Viedma.