That ended Spain's perfect run of six wins in six matches. Italy did stay perfect by overcoming Greece's defensive tactics in a 2-0 victory and qualified for next year's continent-wide tournament. Spain slipped up after goalkeeper Kepa Arrizabalaga gave away a penalty by fouling Omar Elabdellaoui in stoppage time, allowing Joshua King to step up and equalize from the spot just before the final whistle in Oslo.
Spain will have another chance to advance on Tuesday at Sweden, but it will do so without Ramos, who will be suspended for an accumulation of yellow cards. Saúl Ñíguez had put Spain ahead with a long-range goal only two minutes after halftime, and Fabián Ruíz went close to sealing the win when he hit the post on two occasions.
The 33-year-old Ramos surpassed Casillas' mark by making his 168th appearance for "La Roja." "I would trade (the record) for a win," Ramos said. "But it is a reward for all these years of sacrifice. It is an honor. Every time I put on this shirt I am moved with emotion."
Ramos and Sergio Busquets are the last remaining members of the great Spain teams that won the 2010 World Cup and European Championships in 2008 and 2012. Spain leads Group F with 19 points. Sweden has 14 points after beating Malta 4-0 with Sebastian Larsson scoring twice from the penalty spot in the second half.
Romania beat the Faroe Islands 3-0 and has 13 points, three more than Norway. ITALY ADVANCES Italy ensured its qualification from Group J after defeating Greece in Rome. Brazilian-born midfielder Jorginho converted a penalty after the hour mark after a handball by Andreas Bouchalakis. Then substitute Federico Bernardeschi scored from beyond the area.
Roberto Mancini's team got its seventh win in seven matches and has 21 points. Next is Finland with 12 after it lost 4-1 at Bosnia and Herzegovina. Armenia has 10 points — along with Bosnia and Herzegovina — after drawing 1-1 at last-place Liechtenstein.
SWISS AT RISK Denmark beat Switzerland 1-0 to take the joint lead of Group D with Ireland. The Irish were held to a 0-0 draw at Georgia. Denmark and Ireland have 12 points. Switzerland, which has eight points and a game in hand, hosts Ireland on Tuesday.
The top two teams of each group advance. The other four qualifiers will come through four tiers of playoffs in March.
More AP soccer: https://apnews.com/apf-Soccer and https://twitter.com/AP_Sports