On the finest of margins can matches – and even seasons – turn. Tottenham were labouring against their bitter rivals, seemingly out of ideas against an Arsenal team that led through Aaron Ramsey and had executed Unai Emery’s gameplan to the letter.

Spurs were staring at a third consecutive Premier League defeat and the last time that happened was in 2012. The implications were grave. Mauricio Pochettino had conceded that the title was out of reach for his team after the losses at Burnley and Chelsea but another reverse would have imperilled their top-four hopes while simultaneously encouraging those of Arsenal.

Bournemouth v Man City, Manchester United v Southampton and more – live! Read more

Then Christian Eriksen floated in a 73rd-minute free-kick and everything changed. Harry Kane was in an offside position but, contentiously, it was not spotted. If the Spurs striker had not been ahead of the line, perhaps Shkodran Mustafi would not have felt the need to barge him. But he did and when the penalty was awarded Kane duly converted for his ninth goal in nine north London derbies.

Spurs had their reprieve. Or did they? There was still time for another twist, another drama, after another penalty controversy. This time it was for Arsenal and in the 89th minute. Pierre-Emerick Aubameyang, the substitute, had the position on Davinson Sánchez and, as the Spurs defender leaned in on him, there was a tussle.

It was difficult to see what sent Aubameyang tumbling but the referee, Anthony Taylor, spotted something and he stunned the majority of the 81,332 crowd by pointing to the spot. Aubameyang addressed the kick and it stood to give Arsenal a sixth win in seven league games but, agonisingly for him, Hugo Lloris read his intentions and dived low to save. Lloris had made mistakes in the Chelsea defeat. Now he was the hero.

There was more. When Alex Iwobi crossed from the rebound, Aubameyang looked set to tap into the empty net only for Jan Vertonghen to make a last-ditch slide challenge. Vertonghen had encroached deeply into the area on the penalty but he got away with it. Without that, would he have been able to make the tackle?

The Fiver: sign up and get our daily football email.

It ended up as a hard luck story for Arsenal, who had felt that a first away league win over a big-six rival since January 2015 at Manchester City was on. Emery had asked his players to sit deep, stay behind the ball and tackle with everything they had, which they did – even if another substitute, Lucas Torreira, overstepped the mark at the very end. He was high and out of control when he crashed into Danny Rose to receive a straight red card.

Then again, Rose had clattered into the Arsenal goalkeeper, Bernd Leno, on 68 minutes as he stretched for the ball inside the area with his studs up. He was given a yellow card. At the very end, Sánchez appeared to kick out at Laurent Koscielny. It was a game in which Taylor’s decisions came under an unforgiving spotlight and one that, in Emery’s opinion, showed why VAR will be introduced next season.

“Today’s referees have big personality but it’s not enough to make the best decisions in the difficult actions in the box,” Emery said. “VAR is coming to help them. It’s positive for English football.”

Arsenal’s run-in continues at home to Manchester United next Sunday but, that apart, it appears relatively kind. How different their situation would have looked with a victory here. The relief belonged to Spurs, who had started nervously and fallen behind to Ramsey’s goal.

Pochettino drew attention to a cynical 12th-minute tackle from Granit Xhaka on Kane, which cut down the striker as he broke and was clearly worth a booking. Pochettino suggested that it could have been a red card and was the “turning point” of the game. That felt like a stretch.

Facebook Twitter Pinterest Harry Kane got up to equalise from the spot for Spurs but he had been offside before being fouled. Photograph: Tom Jenkins/The Observer

What shaped the game was Ramsey’s burst and finish on 15 minutes. Sánchez overcommitted to reaching a ball out of the Arsenal defence in front of Alexandre Lacazette and, when he missed it, his opponent sent Ramsey away. The Juventus-bound midfielder had the entire Spurs half into which to sprint and he rounded Lloris, held off Victor Wanyama and rolled home.

Lacazette had snatched at a second-minute chance – he looked offside, although there was no flag – and there was a vulnerability about Spurs as they pressed high and left spaces in behind. Iwobi almost made them pay in the 42nd minute when he ran and curled for the far corner, but Lloris saved.

Spurs made attacking inroads in the second half of the first period and they would have been level at the interval but for Leno’s marvellous double save from Eriksen and Moussa Sissoko. Kane had seen a header correctly ruled out for offside but Arsenal defended well both as a unit and in the one-on-ones. Sokratis Papastathopoulos was particularly impressive, and the clear man of the match.

Emery made bold decisions, chiefly the switch to a back four and the omissions of Mesut Özil and Aubameyang from the starting lineup. He was vindicated. “I’m proud of the players,” Emery said. “It was about playing like a team, feeling together. We could have won.”

Quick guide Follow Guardian sport on social media Show Hide Twitter: follow us at @guardian_sport Facebook: like our football and sport pages Instagram: our favourite photos, films and stories YouTube: subscribe to our football and sport channels Photograph: Chesnot/Getty Images Europe

Spurs had too many players who were below their best. Kieran Trippier sank to his knees after overcooking one cross for Son Heung-min while at the other end, he struggled to contain the impressive Iwobi. Eriksen’s sights were awry and Wanyama looked like a player who had not started a game since 10 November. It felt incongruous to hear Pochettino say that Spurs “were better in all aspects”.

Lacazette side-footed wide on 56 minutes from Nacho Monreal’s cut-back and Arsenal were comfortable; Spurs desperate. But Pochettino and his players would find a way back.