Thulani Serero opened the scoring for the hosts in the 19th minute in the Group H clash with a composed finish from six yards out before Danny Hoesen extended Ajax's lead just before the break with a neat piece of skill inside the penalty area.
Barcelona were gifted a way back into the game when Joel Veltman brought down Neymar inside the penalty area and Xavi scored from the spot.
Veltman was shown a straight red card for his challenge on Neymar when conceding the spot-kick, but Liga champions Barca were unable to make the most of their numerical advantage.
The win moves Ajax onto seven points with one game remaining and the club's hopes of progressing to the last 16 rest on beating Milan at San Siro, while defeat for Barca was the club's first of the season.
Frank de Boer had the luxury of being able to name an unchanged side from Saturday's 3-0 win over Heracles and there was a further boost as Lerin Duarte returned to the squad as a substitute.
The visitors made four changes with Carles Puyol, Martin Montoya, Alex Song and Xavi all starting for Gerardo Martino's men.
Despite a confident start, Ajax were lucky to survive a swift Barcelona counter attack in the 14th minute as Veltman made a crucial block to deny Cesc Fabregas.
It was all one-way traffic for the remainder of the first half, though, and the home side got their reward for continuing to pressurise Barcelona at a high tempo as Serero opened the scoring with his first Champions League goal five minutes later.
The South Africa international ghosted into the penalty area to meet Ricardo van Rhijn's cross from the right and the 23-year-old calmly side-footed the ball past Jose Pinto.
After Lasse Schone had missed two chances, Ajax finally doubled their lead just before the break through Hoesen.
Pinto saved well from Viktor Fischer and Hoesen latched onto the loose ball, lifted it past Puyol and fired into the bottom corner.
The game was turned on its head four minutes after the break as Van Rhijn played a loose pass back to Veltman. Neymar latched on to the ball, but he was brought down by the defender just inside the penalty area.
The 21-year-old was given his marching orders and Xavi made no mistake from the spot to halve the deficit.
Jasper Cillessen kept the hosts in the game with a good save from Neymar on the hour and a resilient Ajax defence managed to hold on and seal the win.
STATS ZONE Ajax 2-1 Barcelona analysis
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.