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 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.
The Argentine coach 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.
Also Read
Martino's selection proved inspired as Pedro's lobbed cross was expertly headed into the far corner by Fabregas after just eight minutes.
Barca 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.