The midfielder's future at the club continues to be in doubt after a disappointing first season but was not affected by boos from fans to finish his pre-season off on a high
The midfielder's future at the club remains up in the air heading into the new season, but was on hand to end his pre-season preparations on a high after tapping home from close range.
The game looked to be heading for a draw with Wayne Rooney missing a penalty in the first half before Darren Fletcher scored three minutes after the break.
The Liga outfit proved a tough opponent throughout and Rodrigo Moreno levelled matters after capitalising on a poor clearence by Tom Cleverley inside his own area.
After finding success with a 3-4-1-2 formation as Netherlands boss at the World Cup, Van Gaal has continued to utilise the tactic with United and their players were given a first chance to use it on familiar turf.
Wayne Rooney was named captain and paired with Javier Hernandez, but the England man's first-half penalty miss threatened to spoil Van Gaal's welcome party.
However, a vintage show of United grit after the break ensures the feel-good factor around the club remains in full flow ahead of their Premier League opener against Swansea City on Saturday.
Despite much pomp and ceremony surrounding the game, it got off to a tepid start, though United looked solid in defence and incisive in midfield with Van Gaal's system becoming more familiar.
Ander Herrera scuffed a 24th-minute volley wide, which sparked the remainder of the first half into action.
First, Sofiane Feghouli's low effort was comfortably pouched by David de Gea, before United were given the chance to move ahead just after the half-hour when Rooney was felled by Antonio Barragan under Ashley Young's cross.
Rooney stepped up and lashed a low effort to Alves' right, but the Brazilian sprung superbly to tip the effort onto the post.
Rooney had a half-chance to atone for his miss just before half-time, yet a heavy touch allowed Alves to mop up.
It did not take long after the interval for United fans to be on their feet, however, as Young's corner was cleared to the edge of the area for Fletcher to fire home via a Rodrigo deflection.
Valencia showed no sign of being happy to cede the game and Hernandez had to be alert to nod Rodrigo's flicked header off the line.
The chance prompted a change in momentum and Valencia duly equalised with 20 minutes to go as United's defensive frailties from last season made a return.
Tom Cleverley horribly miscued an attempted clearance from a free-kick into the penalty area, giving Benfica loanee Rodrigo a simple finish from six yards.
Pablo Piatti scuffed wide from inside the six-yard box and Hernandez saw another miscued clearance squirt across the face of goal as panic set in for the hosts.
Yet Fellaini looked in fine form after coming on as a late substitute and he emerged as an unlikely hero, pouncing on Alves' error under a high cross to roll home the winner.