The Argentine forward set up Xavi for the opener after 18 minutes and then left Getafe players sprawling as he dribbled from his own half to net a thrilling second 11 minutes later.
Barca coach Frank Rijkaard said: "It was a great goal from a talented player. It was a work of art."
Just before the break Messi slammed in a third but plucky Getafe struck back with two goals in two minutes early in the second half as Barca's defence creaked.
Eidur Gudjohnsen and Samuel Eto'o restored Barca's three-goal cushion for the away leg next month.
Deportivo Coruna host Sevilla in the other semi-final first leg on Thursday.
Getafe made a confident start, forcing Albert Jorquera into a sharp save after just three minutes, but Barca soon settled to dominate possession.
They made the breakthrough when Xavi laid the ball out wide to Messi and then drifted into the area.
He received the return pass with his back to goal and with a neat pull back spun round to stab a shot inside the far post.
MESSI GOAL
Messi was being closely marshalled but he got clear of two players in his own half and raced towards the visitors' goal pursued by his markers.
He swerved away from two more defenders on the edge of the area and rounded the keeper before lifting the ball into the net from a tight angle.
As halftime approached Deco broke down the left and crossed low for Messi. The Argentine controlled, dummied the defender into committing himself and rifled a shot into the top corner.
Getafe coach Bernd Schuster brought on Daniel Guiza in the second half and the striker made an immediate impact.