* Messi second in all-time Champions League scoring chart
* Barcelona, Valencia and Bayern reach last 16
* Holders Chelsea on brink of exit at first hurdle
* Shakhtar also through after controversial goal (Adds detail)
LONDON, Nov 20 (Reuters) - Lionel Messi fired Barcelona into the last 16 of the Champions League with two goals in their 3-0 victory at Spartak Moscow on Tuesday but holders Chelsea are walking a tightrope after a crushing defeat by Juventus.
Valencia and last season's runners-up Bayern Munich advanced from Group F with a 1-1 draw in the Mestalla while free-scoring Shakhtar Donetsk beat Nordsjaelland 5-2 with a controversial Luiz Adriano hat-trick smoothing their progress from Group E.
The Brazilian seemed unaware that his team mate Willian was playing the ball back to the Danish side's keeper following an injury and pounced to score his first goal sparking jeers and whistles from the crowd and angering the incredulous home side.
Messi's brace for Barca took his tally in Europe's flagship club competition to 56, equal second on the all-time scorers' list with Dutchman Ruud van Nistelrooy, as the Catalans guaranteed top spot in Group G.
Juventus are favourites to join Shakhtar in the last 16 after a 3-0 defeat of Chelsea to move second in Group E.
A draw for the Italians in Ukraine in a fortnight would mean Chelsea having the dubious distinction of becoming the first defending champions to exit at the group stage.
Fabio Quagliarella gave Juventus a 38th minute lead with a deflected shot and Arturo Vidal's second half effort was also diverted past Chelsea goalkeeper Petr Cech on the hour.
Sebastian Giovinco rounded off a dazzling performance from Juventus with a breakaway third in stoppage time.
"We said before the game that we have our destiny in our hands, not any more," Chelsea keeper Petr Cech said.
"Now we need to do our bit, we need to win our last game and hope our fate is kind. Being realistic Juventus played very well and they need just a point and Shakhtar are already through.
"It's a very sad moment."
Chelsea coach Roberto Di Matteo left striker Fernando Torres out of the starting lineup but his plan backfired, leaving further question marks about his future after his side's slump in form over recent weeks.
"In a big club like this if you have a few bad results you're always going to be under pressure, I knew that from day one," the Italian told Sky Sports.
Shakhtar trailed twice against Nordsjaelland and although their victory was ultimately comfortable it was also thick with controversy as their first goal left the home side fuming.
Willian had sportingly played the ball back to Nordsjaelland's goalkeeper after a break in play to treat Morten Nordstrand but Adriano, seemingly unaware of his team mate's sense of fair play, nipped in to equalise.
"Their attacker didn't get it," Nordsjaelland captain Nicolai Stokholm told reporters.
"I looked down at my armband, and there's something about respect - it has to be said we didn't see much of that."
After their shock defeat at Celtic, Barcelona rediscovered their verve with a comfortable victory as Spartak's artificial surface proved perfect for their passing game.
Messi scored his 79th and 80th goals of 2012 in the first half and is closing in on Gerd Mueller's calendar year record of 85 set in 1975. Dani Alves had opened the scoring for Barca.
"We couldn't allow what happened at Celtic to happen again," Messi told Spanish TV.
While Barca have an unassailable 12 points, the runners-up spot is in the balance after Benfica beat Celtic 2-1, meaning they both have seven points with one game left.
Scottish champions Celtic were 20 minutes away from the score draw that would have put them through along with the Spaniards before Argentine Ezequiel Garay struck the winner on a night of torrential rain in Lisbon.
Celtic host Spartak in their final group game knowing they will have to better Benfica's result against Barcelona.
Valencia were already certain of a last 16 place before they even kicked off against Bayern Munich after BATE Borisov's 2-0 loss to Lille in an earlier kickoff.
Thomas Mueller's late equaliser for Bayern then spared the German club a nervy final night in the group stage as a draw was enough to put them out of reach of BATE.
Valencia played two thirds of the match with 10 men after Antonio Barragan was sent off for a wild tackle on David Alaba in the 33rd minute.
"If you play with an extra man for an hour and have to be content with a 1-1 draw it's not satisfactory," Bayern chief Karl-Heinz Rummenigge said on the club's website (www.fcbayern.telekom.de).
"We have to put our foot on the gas again."
Galatasaray kept alive their chances of reaching the knockout phase with a 1-0 victory over already-qualified Manchester United.
They are vying with CFR Cluj for the runners-up spot in Group H after the Romanians beat Braga 3-1 with a first-half hat-trick from Rui Pedro doing the damage. (Reporting by Martyn Herman; Editing by Ken Ferris)