Barcelona bounced back from consecutive defeats away to Ajax and Athletic Bilbao with a 4-1 win at third-tier Cartagena in the first leg of their Copa del Rey fourth round tie on Friday.
With Barca in need of a response after two disappointing performances, coach Gerardo Martino named a strong side including Alexis Sanchez, Cesc Fabregas and Sergio Busquets.
However, Fernando fired the hosts into a shock lead after just 16 minutes when he got in behind the Barca defence before finishing across Jose Manuel Pinto into the far corner.
Pedro Rodriguez calmed the visitors' nerves eight minutes before the break with an equaliser and Fabregas completed the turnaround with a neat finish seven minutes later.
Barca should have put the tie to bed early in the second period as Sanchez and Fabregas passed up fine chances to extend their advantage.
Pedro did eventually make it 3-1 15 minutes from time when he finished expertly from Sanchez's pass.
And Cameroonian teenager Jean Marie Dongou rounded off the scoring in stoppage time with his first senior goal for the club on the rebound after Pedro had struck the post.