Goals by Alvaro Garcia and Fran Garcia put the mid-table hosts in a commanding position before Robert Lewandowski scored a late consolation.
They host fifth-placed Real Betis on Saturday (kick-off 20:00pm)
Garcia put Vallecano ahead after firing across Marc-Andre ter Stegen before Garcia doubled the lead.
Lewandowski pulled one back after Franck Kessie’s shot was blocked, his 18th La Liga goal of the season.
It was Barcelona’s first defeat in La Liga since 26 February, while they have won just one of their past four league games.