by coach Gerardo Martino, although they were leaving gaps at the back which Valencia exploited towards the end of the first half.
After visiting defender Ricardo Costa headed wide from a corner, Parejo equalised from close range a minute before the break after Sofiane Feghouli had pulled the ball back.
Valencia went ahead three minutes after the restart when Piatti headed home a loose ball inside the penalty area as Barcelona's defensive woes continued, with Gerard Pique and Javier Mascherano in particular struggling.
Messi pulled the home side level from the penalty spot in the 54th after a handball by Costa but Alcacer restored Valencia's lead just before the hour when he steered home another Feghouli assist.
Fullback Alba was sent off for a second yellow card when he attempted to prevent Piatti breaking away. Messi was then inches away from drawing Barca level near fulltime, but his shot went just past the post, consigning his side to their second league defeat of the season.
A brace from Portuguese winger Duda helped Malaga beat Sevilla 3-2 in their Andalusian derby.
Duda put Malaga ahead from the penalty spot after he himself was brought down by fullback Coke but Sevilla came back after the break.
Carlos Bacca finished clinically in front of goal and then Federico Fazio headed in a free-kick before Samuel Garcia brought Malaga level.
Duda was again on target seven minutes from the end to give Malaga a victory that gives them a four-point cushion over the relegation zone in 13th place.