However, his return lasted only 23 minutes as he had to be helped off the field by two members of the Barca medical staff as he turned his ankle trying to cross the ball from the left side of the area.
The visitors shrugged off the loss of the Brazilian, as Cristian Tello's driven cross was turned in at the near post by Messi two minutes before halftime.
And the best was still to come from the diminutive Argentine as he danced past three Getafe challenges before rounding goalkeeper Jordi Codina and finishing from a tight angle for his fourth goal of the tie just after the hour mark.
Martino then took the opportunity to hand Xavi Hernandez his 700th appearance for the club as he replaced Cesc Fabregas with 20 minutes remaining.
Messi should have rounded off his evening with a hat-trick on 85 minutes as he was played in with just Codina to beat, but the keeper made a fine save with his right leg to turn the ball behind for a corner.
Barca will face Levante in the quarter-finals which start on January 22.
Also on Thursday, Real Sociedad qualified by winning 1-0 at Villarreal, via a goal from Javi Ros, just four days after crashing 5-1 against the same team in La Liga.
Sociedad will play third-division side Racing Santander in the last eight. The other quarter-final pairings are Espanyol against Real Madrid and holders Atletico Madrid taking on Athletic Bilbao.
-AAP