But Nketiah added his second early in the second half and a Chelsea team featuring Romelu Lukaku leading the attack this time had no response. Bukayo Saka made sure of the vital three points when converting a stoppage-time penalty.
- ESPN+ viewers' guide: LaLiga, Bundesliga, MLS, FA Cup, more
- Don't have ESPN? Get instant access
The victory snaps a three-game losing streak for Arsenal and lifts back level on points with fourth-placed Tottenham and three points ahead of Manchester United, who have played a game more, in sixth.
Despite defeat, Chelsea maintain a five-point cushion in third and have a game in hand on both Arsenal and Tottenham.
Arsenal struck first in a frenetic first half when Nketiah pounced on a weak back pass by Andreas Christensen in the 13th minute and then when Smith-Rowe finished off a flowing counter-attack in the 27th.
But the visitors were quickly pegged back on both occasions, first after a deflected effort from Werner and then a close-range finish by Azpilicueta from a Mason Mount cross.
Nketiah restored the visitors' lead in the 57th minute when he seized on another mix-up in Chelsea's defence to make it 3-2, stabbing the ball home after Thiago Silva's interception bounced into the Arsenal striker's path off Malang Sarr.
Chelsea pressed for a third equaliser, bringing on Kai Havertz for out-of-form record signingLukaku who largely failed to impress once again when given a rare start by coach Thomas Tuchel.
But Saka rounded off the win when he converted a penalty in the 92nd minute after he was adjudged to have been fouled by Azpilicueta.
The defeat represented the first time since 1993 that Chelsea lost three consecutive home games having been beaten by Brentford in the league and Real Madrid in the Champions League. They conceded a total of 11 goals in those games, a run of form that contrasts with their usually secure defence under Tuchel.
Arsenal had lost their three previous league matches.
"We wanted to give the fans something to believe in us and we did that," Saka told Sky Sports. "We showed fight and character. It's a huge result. It means a lot to us. Losing three games in a row is really difficult."
Wednesday's game was played with some sections of Stamford Bridge unfilled after the government ruled in March that Chelsea could not make new ticket sales to their fans under restrictions linked to the club's Russian owner Roman Abramovich.
Information from Reuters was used in this report.