The four-time World Player of the Year replaced Andres Iniesta after 63 minutes with Barcelona leading 2-0 thanks to a Cesc Fabregas double.
Messi then put the tie to bed a minute from time when he slotted home a loose ball inside the area.
And he added his 16th goal of the season with a stunning run and finish to round off the scoring in stoppage time.
"I had a lot of time out and I felt very good in the training sessions that I had, but playing in a competitive game in completely different," Messi told Barça TV.
"More than just the goals, I feel very good physically and I have been able to play without any pain so I am obviously very happy."
Barcelona boss Gerardo Martino also had Saturday's upcoming top of the table clash away to Atletico Madrid in mind as he made had made six changes to the side that started last weekend's 4-0 win over Elche.
However, with Messi and Neymar, ruled out by a stomach bug, again not in the starting line-up, Martino maintained the front three of Alexis Sanchez, Pedro Rodriguez and Fabregas.
And despite such a stunning return, Messi said he isn't convinced he will start at the Vicente Calderon on Saturday.
"I will speak with Tata and he is the one that will decide, but right now I don't know," he said.
"No one is irreplaceable. I watched the games at home and they were very impressive. Whoever plays in this squad they always respond to the challenge."
Martino's selection proved inspired as Pedro's lobbed cross was expertly headed into the far corner by Fabregas after just eight minutes.
However, Getafe then managed to stifle Barça from creating too many clear-cut chances before the break and indeed the hosts were grateful to a great save from Jose Manuel Pinto to turn away Juan Rodriguez's header to go in ahead at half-time.
Barça did finally have the breathing space they craved when Juan Valera upended Pedro inside the area and Fabregas blasted the resulting penalty into the top corner.
That set the scene for Messi's arrival and he didn't disappoint as he calmly slotted home a loose ball inside the area with his trusted left-foot after Martin Montoya had burst into the Getafe box.
The best was still to come, though, as Messi embarked on a trademark run through the Getafe defence before slamming high past Jordi Codina to leave next week's second leg in Madrid a formality.