It was a winner-takes-all scenario in unusually wet and cool conditions in Papeete, and the two teams turned in a stunning show of the sand-based game played in free-flowing fashion.
The Solomons were aiming to reach their maiden knockout stage in a FIFA tournament, which would also mean two OFC nations achieving the feat for the first time in the same tournament.
Ruiz had his side 2-1 to the good by the end of the first period, and his remarkable shooting helped his side move 4-2 ahead, only for Nicholas Muri to almost single-handedly draw his side level by the end of the middle period.
El Salvador again moved clear and it proved a gap that was too far to bridge for Solomons who fell narrowly short of achieving a new milestone.
The result lifts El Salvador, who finished fourth at Ravenna 2011, into a quarter-final meeting against Spain.