La Liga Wrap: Valencia end Real's winning run
Leaders Real had embarked on a record-breaking sequence stretching back to September, but it came to a halt at Mestalla.
Things began well for the European champions as Cristiano Ronaldo struck his 26th league goal of the season from the penalty spot in the 14th minute.
However, Antonio Barragan netted his first Liga strike since March 2007 - via a wicked deflection off Pepe - to equalise shortly after half-time.
With 25 minutes remaining, Nicolas Otamendi rose highest to power a header into the net from Dani Parejo's corner as Valencia moved to within five points of the leaders.
That defeat for Real meant victory for Barca at Sociedad would have seen Luis Enrique's men climb to the summit, but Jordi Alba's own goal in the second minute extended their winless run at Anoeta Stadium to six matches in all competitions.
Lionel Messi and Neymar were both left on the bench from the start, but even the introduction of two of Barca's biggest stars could not inspire the visitors to find an equaliser.
Getafe's winless league run was extended to seven matches as they fell to a 2-1 home defeat at the hands of Rayo Vallecano.
Alvaro Vazquez gave the home side an excellent start with a third-minute opener, but goals from Jozabed and Raul Baena turned the game in the visitors' favour.
Elsewhere, Eibar defeated Espanyol 2-1 thanks to goals from Manu del Moral and Federico Piovaccari, with Felipe Caicedo's effort 10 minutes from time nothing more than a consolation for the hosts.