Arsenal were losing 2-1 when Pepe came on in the 75th minute and he scored five minutes later with a curling effort from 25 yards.
He repeated the feat in stoppage time as Arsenal avoided their second straight defeat and retained their place at the top of Group F.
Former Tottenham youngster Marcus Edwards had earlier cut inside and fired into the bottom corner to give Vitoria a shock lead, before Arsenal’s Brazilian teenager Gabriel Martinelli nodded in his fifth goal in just his third start to make it 1-1.
Bruno Duarte restored the visitors’ lead on 36 minutes, pouncing on a rebound to send Arsenal into the half-time break a goal behind.
The Gunners, who were poor for large patches of the game, burst into life in the final 10 minutes as Martinelli was denied from close range before Rob Holding’s header was well held by the goalkeeper.
Arsenal manager Unai Emery made 10 changes from the side that lost to Sheffield United in the Premier League on Monday but was forced to bring on Matteo Guendouzi and Dani Ceballos at half-time, before Pepe made the difference and gave Arsenal 3~2 win over Vitoria Guimaraes