Rui Jorge's side needed one more goal to qualify as the best-performing second-placed team, but fell short in Poland.
It means they will be unable to mirror the achievement of Cristiano Ronaldo and Co. following their success in France last year.
Portugal were ahead inside two minutes through Edgar Ie, while Bruma struck to make it 2-0 before Enis Bardhi reduced the arrears.
Daniel Podence restored Portugal's advantage and, after Kire Markoski hit back for Macedonia, new RB Leipzig signing Bruma doubled his tally late on.
It proved too little too late and in the frustration there was a stoppage-time red card for Diogo Jota.
Spain had already thrashed Macedonia 5-0 and downed Portugal 3-1.