Ruiz, who is having an impressive season with Belgian second-division side Royal Mouscron Peruwelz, scored after receiving a pass near the midfield line from Gabriel Leiva. The 19-year-old dribbled powerfully into the left side of the Haitian box, cut inside with his right as a defender glided by and netted from 10-yards out.
Haiti, knowing that it needed at least a draw to maintain hope of progressing, turned up the intensity and was unlucky not to score on numerous occasions throughout the remainder of the match.
Nazon Dukens proved to be a dominant presence for Les Grenadiers and forced a 40th minute stop from Costa Rican Jairo Monge.
Within the first 12 minutes of the second half, Dukens uncorked shots with both feet that looked goal bound, but the superb Monge was up to the task each time.
In the 79th minute, Monge somehow managed to make a save with his left hand -- while falling in the opposite direction -- after Luckner Junior Hart weaved his way through the right side of the Costa Rican penalty area.
Monge's heroics, combined Haiti's lack of good fortune in front of the goal (it hit the post three times), was enough to propel the Central Americans into the next round.
Before that quarterfinal date against a yet to be determined opponent is set, the Ticos will meet the U.S. for first place in the group on Friday.
Note: Haitian starting goalkeeper Ronald Elusma left the game in the 36th minute with an apparent leg injury.