Manchester United were denied a place in the Champions League knockout phase as Michael Lang's late strike secured Basel a memorable, and deserved, victory.
Jose Mourinho's men started Group A with four successive victories and could have qualified without even kicking a ball had CSKA Moscow failed to beat Benfica in the early kick-off.
It still appears a case of when rather if United reach the last-16, but Basel's late 1-0 win means progress is not yet completely certain ahead of the Russians' visit to Old Trafford next month.
Mourinho's men still boast a three-point cushion but things could have been so different had his side showed cutting edge in the first half.
Marouane Fellaini saw a header cleared off the line and Anthony Martial's cross hit the post, with Marcos Rojo seeing an outrageous long-range effort deflected onto the bar on his return from a cruciate ligament injury after 216 days out.
The visitors dominated the opening period but tailed off markedly after the break as Basel repeated their memorable win on United's last visit to St Jakob-Park in 2011.
Lang hit the woodwork as Sergio Romero's goal was met by wave after wave of attacks, with United's defence eventually buckling in the 89th minute as Raoul Petretta's cross was turned home by Lang.
United could have been out of sight had they shown their teeth in the first half.
Paul Pogba, captaining the side for just the second time, was forced off with a hamstring injury when the sides met in September and was looking to follow-up his man-of-the-match return against Newcastle with another telling contribution.
The Frenchman's close control was impressive on the ropy St Jakob-Park pitch and his outstanding no-look through ball almost led to a 12th-minute opener, only for Romelu Lukaku to be denied by Tomas Vaclik.
United recycled the play and Manuel Akanji had to clear off the line as Fellaini met Daley Blind's cross with a powerful header.
The Belgium midfielder nodded wide after again being found by Blind soon after as United looked to translate dominance into a goal without creating any clear-cut chances until half-time approached.
Martial switched on for the closing minutes of an otherwise anonymous first-half display, sending in a sublime cross that hit the post after Fellaini failed to make a telling touch.
Moments later the Frenchman was racing through on goal, making light of Basel's defensive attention to force Vaclik into a save.
There was nothing the Basel goalkeeper could do when Rojo took aim from distance, though. The returning defender's audacious long-range attempt rattled the crossbar thanks to Marek Suchy's intervention.
Martial's fine floated cross gave Lukaku a chance soon after the second half got under way, but Basel were looking brighter and Serey Die went close with a thumping first-time strike.
The front three of Mohamed Elyounoussi, Dimitri Oberlin and Renato Steffen were asking questions of United's backline with increasing regularity.
Steffen ghosted in from the right to get away a shot that flew across the face of goal, before Lang beat Blind to a floating cross and headed off the woodwork.
Elyounoussi's follow-up was denied as Basel looked for another memorable result against United, with Steffen seeing a penalty claim denied before Rojo produced a superb last-ditch challenge.
Substitute Marcus Rashford rippled the side-netting on an all too rare United attack, with Romero required to produce a fine save to deny Die from distance.
Basel were pushing for the winner and got it in the 89th minute.
Petretta's threatening low cross just evaded Oberlin under pressure from Rojo, but Lang beat Blind to the cross to direct home at the far post.