Rodrigo Moreno scored the only goal in the first half as Albert Celades' men secured a surprise victory that means they finish top of the group, ahead of Chelsea in second spot, despite Gabriel's late red card.
Ajax reached the semi-finals last season, knocking out Real Madrid and Juventus during a thrilling run, but they were edged out by the LaLiga side at the Johan Cruijff Arena on Wednesday.
Rodrigo headed wide in the second minute but scored the decisive goal midway through the first half, taking advantage of Joel Veltman playing him onside.
Ferran Torres shaped to shoot from outside the box but instead played a clever disguised pass into the feet of Rodrigo, who fired into the roof of the net.
Jaume Domenech reacted well to keep out a cross-shot from Hakim Ziyech that looked to be curling inside the far post, then Andre Onana denied Rodrigo at the other end.
Rodrigo continued to offer Valencia's main threat and went close again in the 55th minute, and Ziyech wasted a clear chance from six yards as Ajax grew increasingly nervous.
Noa Lang's acrobatic effort flew wide before Erik ten Hag sent on Klaas Jan Huntelaar, and Domenech had to save from Lisandro Martinez and Ziyech at the death.
Gabriel then saw red for appearing to headbutt Ajax captain Dusan Tadic in added time, but the 10 men held on to qualify.