Spain scored a dramatic late winner to edge Switzerland in the Nations League.
The game in Tenerife was effectively a dead rubber with the hosts having already won Group A4 and Switzerland guaranteed bottom spot.
Pedri, in his hometown, had a penalty saved but fellow Canary Islander Yeremy Pino slammed in the rebound for the 32nd-minute opener.
Joel Monteiro levelled for the Swiss in the 63rd minute, but Bryan Gil put much-changed Spain back ahead five minutes later.
With five minutes left, Andi Zeqiri netted a penalty to make it 2-2, but Bryan Zaragoza's spot-kick in the third minute of added time sealed the success for La Roja.
Denmark joined European champions Spain in the quarter-finals after a goalless draw in Serbia.
Hosts Serbia, who needed a victory to finish second, had 22 shots without scoring and had defender Strahinja Pavlovic sent off in the fifth minute of injury time.
They finish third and will face a League B side in a relegation-promotion play-off.