Messi scored in the 59th by dribbling between a defender’s legs before making it 2-0 after Xavi Hernandez had opened the scoring two minutes before halftime.
Players from both teams wore T-shirts before the game with messages of support for Vilanova, who had throat surgery to remove a second tumor in two years from a saliva gland on Thursday.
Barcelona remained perfect in nine away games and extended its record league start with its 16th win in 17 rounds. It opened up a nine-point lead over second-place Atletico Madrid and a 16-point gap over Real Madrid before it visits Malaga later Saturday.
Barcelona was coached by assistant Jordi Roura, with Vilanova being released from hospital just moments before the game. He is expected to undergo around six weeks of chemotherapy and radiotherapy.
“This win is for Tito,” said Barcelona defender Dani Alves. “It’s a surprise and joy that he is home now. We are here to help him any way he can. Football is secondary now, he is fighting for his life.”
Valladolid has been one of the quiet surprises in the league this season, playing attractive attacking football and proving tough to beat at home.
But Messi was just too much for the promoted team to handle, starting the move for Xavi's opener before netting what proved to be the winner.
The 25-year-old star finished 2012 with 79 goals for Barcelona: 59 in the Spanish league, 13 in the Champions League, five in the Copa del Rey and two in the Spanish Super Cup. He had 12 for Argentina: five in World Cup qualifiers and seven in friendlies.
Valladolid did well to dispute possession with Barcelona early on at Jose Zorilla stadium.
Barcelona, however, slowly but surely tightened its hold on the ball and the cracks began to appear in Valladolid’s defense.
After Messi had hit the post with a free kick, Barcelona finally unlocked the hosts' defense with a dizzying combination of one-touch passes. Messi played Jordi Alba wide on the left flank for the defender to slice a low cross in to Xavi Hernandez, who volleyed the ball home.
Barcelona’s Pedro Rodriguez hit the post with a header just after the break, and Messi uncharacteristically missed well wide with only the goalkeeper to beat.
But Messi made up for it moments later with goal that few could match. Valladolid appeared to have him hemmed in, but Messi sped by one defender, slipped the ball through the legs of a second, and let rip an unstoppable left-footed shot off the far post to put the result beyond doubt.
Messi leads the Spanish league with 26 goals this season.
Javi Guerra got Valladolid's consolation goal in the 88th, before substitute Cristian Tello capped the win for Barcelona in injury time.
Also on Saturday, Mallorca won 2-1 at Real Betis, escaping the relegation zone and breaking a dire run of 11 league games without a victory.