Spurs looked to be heading into the Europa League after a listless first-half performance in a hostile environment saw them trail to Chancel Mbemba's header.
But an improved display after the break saw Clement Lenglet equalise and Pierre-Emile Hojbjerg snatch victory at the death to ensure their place in the last 16 with a first European win away from home in eight attempts.
It was fitting that qualification was sealed so late after last week's VAR intervention against Sporting Lisbon meant their fate went down to the final group game.
The entire 90 minutes was filled with jeopardy as Spurs knew defeat would send them out, but victory ensures they progressed to the knockout stages for the fourth successive time in this competition and they will face a second-placed team when it resumes in 2023.
This was never going to be easy, especially with Antonio Conte confined to the stand due to a touchline ban, and there was a sense of inevitability about how the game started given Spurs' troubles on the road in Europe and Marseille, with three ex-Arsenal players in their side, were out of the traps fast.
Alexis Sanchez could have given them the lead inside the opening five minutes but he headed Amine Harit's cross just wide.
The former Gunner, who scored three times against Spurs in his time in England, was looking Marseille's most dangerous player and he tested Hugo Lloris with a shot on the turn, but the France goalkeeper was equal to it with a parried save.
Spurs were perhaps waiting to catch their hosts on the break, but they lost a key component to that plan on the half-hour as Son Heung-min was forced off after a heavy collision with Mbemba.
The South Korean had a bloodied nose and walked off very wobbly, meaning he could be a doubt for Sunday's game with Liverpool due to possible concussion protocols.
Lloris was Spurs' busiest player and he produced a flying save to keep out a fierce Jordan Veretout drive that was heading for the top corner.
But eventually Marseille's pressure told and they scored in first-half stoppage time.
Ryan Sessegnon's mistake led to a corner which Marseille took quickly and Mbemba powered home a free header at the far post.
Spurs looked condemned, having not even completed a forward pass in Marseille's half, but came out in the second half and immediately improved, levelling in the 54th minute.
Ivan Perisic sent in a delicious free-kick which Lenglet headed home as Spurs continued their set-piece prowess.
The game had changed and Conte's side were beginning to find space and had moments where they could have taken the lead.
They wasted a chance to counter as Rodrigo Bentancur overhit a pass to Lucas Moura who was through on goal, but Spurs recycled the ball and when Emerson Royal's cross was spilled by Pau Torres, Harry Kane could not adjust his feet in time to tap-in.
They thought their moment had come in the 80th minute as they worked a throw-in brilliantly as Bentancur and Moura combined to tee up Hojbjerg, whose shot from 14 yards crashed against the crossbar.
A minute later Kane was through on goal but was denied by a brilliant last-ditch tackle by Mbemba just as he was about to pull the trigger.
Spurs survived a hair-raising moment in the 87th minute as former Arsenal player Sead Kolasinac put a free header wide at the far post.
It looked like it would be job done with a draw but Spurs made sure at the death as Kane played in Hojbjerg who finished emphatically to silence a hostile Marseille crowd.