Tottenham survived a Europa League scare as they needed two goals in the final 10 minutes to beat Lokomotiv Plovdiv in the second qualifying round.
Spurs named a strong team in Bulgaria but were facing an embarrassing loss when Georgi Mindev put the hosts ahead in the 71st minute.
But Jose Mourinho's men saved face with an impressive comeback as a Harry Kane penalty, after an incident which saw two Plovdiv players sent off, and Tanguy Ndombele's 85th-minute winner sent them through.
Ireland full-back Matt Doherty played the full 90 minutes for his new club.
The London side will now face Macedonian outfit Shkendija in next Thursday's third qualifying round.
Spurs will hope that Gareth Bale will not have been watching ahead of his proposed return to the club as they laboured against a much weaker team.
It could have been a much easier evening had Son Heung-min done better inside the opening 10 minutes as he shot at the legs of Martin Lukovs after being played in by Giovani Lo Celso.
Steven Bergwijn rattled the crossbar soon after from the edge of the area and then the Dutchman should have won a penalty after being clearly tripped, but the referee chose not to give it.
Spurs continued to press and Kane and Ben Davies had further opportunities, but Mourinho's men could not find a breakthrough.
They had their best chance eight minutes after the restart when Davies teed up Son, but he clipped over from six yards when it seemed easier to hit the target.
Mourinho's men then had the rug pulled out from under their feet as they conceded from a set-play.
A corner was flicked on to the back post where Minchev ran in to slam past Hugo Lloris.
That spurred the Premier League team into action and they levelled nine minutes later as Davies' header was handled on the line by Dinis Costa who was sent off, with team-mate Birsent Karagaren following for a second yellow card after strong protests.
Kane made no mistake from the spot, firing high into the net to open his account for the season.
Five minutes later, there was a huge sigh of relief as Ndombele was on hand to convert Lucas Moura's pass after Spurs had got in down the right.