Manchester United 1 FC Porto 1
Porto were already 2-1 up from the first leg, but after Paul Scholes had given United a first-half lead it looked as if the 1999 champions would go through on away goals.
However, when Tim Howard flapped at a free-kick, Costinha was on hand to lash home gleefully and send Porto through 3-2 on aggregate.
Sir Alex Ferguson's team selection smacked of a side looking for a single goal victory - with only Ruud van Nistelrooy playing as an out-and-out striker, and two defensive midfielders sitting back to allow Scholes and Ryan Giggs to roam.
The first half was a bitty affair, with Manchester United showing the lack of cohesion that has haunted them of late and Porto looking more nervous than they had in the first leg.
It took 31 minutes for the deadlock to be broken - and it was a goal of great quality, shining out from under the bushel of scrappiness that engulfed it.
A wonderful ball from Giggs released the impressive John O'Shea down the left and the Irishman cut back before floating a tempting cross that was headed home with aplomb by Scholes.
Porto briefly fired, and inevitably it was the tricky Carlos Alberto that nearly benefited from a terrible mis-hit clearance by Eric Djemba Djemba, only to find Howard equal to his low shot, and Maniche woefully off target for the follow-up.
Scholes had the ball in the back of the net again, only to have his poacher's effort ruled out by the linesman, who took his time to make an erroneous decision.
The second half nearly started with an equaliser, when Nuno Maniche's shot was well blocked by Wes Brown, but nearly span over Howard, who saved well under pressure.
Carlos Alberto then had another half chance, whilst at the other end Ruud van Nistelrooy, who had only had a brief glimpse of goal in the first half, began to show signs of getting a foothold in the game.
United sat back and invited pressure on to themselves as the game went on, and with the Old Trafford crowd's nerves beginning to fray, the last 25 minutes were a fraught affair, capped by Costinha's opportunistic leveller.
In truth Manchester United can have little complaint at the result after failing to spark in the latter stages of this competition.