Barca struggled to get out of the blocks and the home side nearly took the lead when Gaku Shibasaki’s cross to the far post was almost deflected into his own net by centre-back Gerard Pique.
The Spain international was having a poor game and he was lucky not to give a penalty when hauling down Jorge Molina, with the referee deeming the foul took place outside the area.
Getafe’s energy and pressure was too much for the Catalans and they were able to take the lead when Shibasaki fired in a superb 20-yard volley on 39 minutes, leaving Marc-Andre ter Stegen helpless in goal.
Argentina international Lionel Messi almost levelled the scores just before the break but his brilliant free-kick, that seemed destined for the top-left corner, was superbly tipped around the post.
Luis Enrique felt the need for change at the break, bringing on Denis Suarez for Andres Iniesta, and the substitution was crucial when the new man stroked a crisp finish into the top-left corner from insides the area on 62 minutes.
Both teams continued to press for a winner but it was the visitors who managed to strike the decisive blow when Paulinho, who was brought on in the second half in place of Ivan Rakitic, drove into the box before firing a lovely finish across the keeper.
Barcelona will feel fortunate to leave with all three points after being nowhere near their best against an impressive Getafe outfit.
Morecambe have paid tribute to former club president Jim Bowen, who died earlier this week aged 80 following a battle with ill health.
Matt Crooks beginshis suspension when Northampton host Rotherham in League One on Saturday.