The tiny Central American nation has won games in beach football events and, of course, in qualifying and friendly matches, but never at a main event in the full version of the sport.
The goals game from Diego Coca and Jose Pena as El Salvador came from behind to claim a famous win with a backs-against-the-wall second half in Rize.
“It’s a historic and incredible moment for our country,” diminutive midfielder Coca told FIFA afterwards. “When the referee blew the final whistle it felt like we were touching the sky.
“To be honest, I don’t think it’s sunk in yet.”
“We know what this signifies for our country and we wanted to make them proud of us,” he added.
“We already made history at the CONCACAF tournament by qualifying for our first U20 World Cup and we knew we could do even better and carry on writing our story.”
The result means El Salvador lie third in Group C with three points, behind hosts Turkey on goal difference.
However, they must beat unbeaten group leaders Colombia in their final game, or get a draw and hope Turkey lose to Australia, who are bottom with no points.
In the other group encounter, Turkey lost 1-0 to Colombia thanks to Juan Quintero’s second half goal.
In Group D, Greece and Mali drew 0-0 while Paraguay beat Mexico 2-1.
That result leaves Mexico on the brink of exiting the tournament. Greece and Paraguay are joint top on four points and play each other on Friday, while Mali have two points.