European champions Spain suffered a first qualifying defeat for eight years as former Chelsea player Miroslav Stoch helped earn Slovakia a famous victory.
Iker Casillas deflected Juraj Kucka's 30-yard free-kick into his own net to give the hosts the lead in the Euro 2016 Group C clash.
Substitute Paco Alcacer equalised for the Spain with a composed low finish from eight-yards.
But Stoch won it with a close-range header after a cross by Michal Duris.
Pain for Spain
Spain's last qualifying defeat was on 7 October 2006 when a side containing the likes of David Villa and Fernando Torres lost 2-0 away to Sweden in a Euro 2008 qualifier
The final whistle was greeted by a huge roar as the visitors, who defeated Italy 4-0 in the Euro 2012 final, lost for the first time in 37 World Cup and European Championship qualifying matches, a run stretching back to 2006.
"We showed patience but we were not effective and their keeper was superb," said Spain manager Vicente del Bosque.
Costa, who has scored nine goals in seven Premier League games for Chelsea, has not found the net in six appearances for his country.
Spain, who travel to Luxembourg on Sunday, have three points from two games, while Slovakia head the group with two wins from two.
Spain have lost four of their last six matches
Elsewhere, England's Group E rivals Lithuania and Slovenia both won.
Switzerland lost for the second straight game as a 79th-minute penalty by Milivoje Novakovic earned Slovenia a 1-0 win.
Lithuania made it two wins out of two as Saulius Mikoliunas struck 14 minutes from time to sink Estonia, who host England on Sunday.
Ola Toivonen's second-half goal earned battling Sweden a 1-1 draw with Russia in Group G after Alexsandr Kokorin had given the visitors the lead in Stockholm.
In the same group, Austria secured a 2-1 win away to Moldova.
Ukraine scored two late goals to win 2-0 away to Belarus in Group C, while Besart Abdurahimi struck deep into stoppage time as Macedonia left it late to beat Luxembourg 3-2.
Also in Group C, Montenegro were held to a goalless draw away to Liechtenstein.
- Blunt and Blay: Real reason why the Church won’t allow a Muslim student to fast in a ‘Mission School’
- #FixTheCountry: How an IGP meet-up turned into a ‘Cabinet Meeting’, without the IGP – Convenor reveals
- National security cloned #FixTheCountry protester’s mobile phone – Barker-Vormawor alleges
- #FixTheCountry organisers exhibited ‘bad faith’ during National Security meeting – Godfred Dame
- Akufo-Addo has not lived up to expectation – Kofi Bentil
- I have no regrets participating in ‘OccupyFlagstaffHouse’ protest – Kofi Bentil
- Playback: Newsfile discusses #FixTheCountry brouhaha; Muslim students not allowed to fast in public Christian school
- We tried to have children for about 10 years – Ebo Whyte’s wife recounts
- Vehicle towing cost to be borne by insurance industry – NIC Commissioner
- It’ll take time for government to get economy back on track – Kojo Oppong Nkrumah
China rocket debris ‘disintegrates over Indian Ocean’
Livestream: Church service with Pastor Mensa Otabil
Saul ‘Canelo’ Alvarez v Billy Joe Saunders: Mexican wins with eighth-round stoppage
Benjamin Azamati qualifies for Tokyo Olympics 200m event
Ghana recorded 10,684 newborn jaundice cases in 2020
Takoradi Technical University establishes Cyber-security Centre
Covid-19 remains a threat to national security – Interior Minister
Armed robber nabbed in Tema
Driver arrested for robbery at Gindabor, 5 others on the run in Savannah Region
We tried to have children for about 10 years – Ebo Whyte’s wife recounts
Teachers call for improved working conditions
Aguero misses penalty as Chelsea’s win makes Man City wait for title
Bayern celebrate winning ninth straight Bundesliga title with 6-0 victory
Atletico stay top after draw at Barca
It’ll take time for government to get economy back on track – Kojo Oppong Nkrumah