Aliou Cisse's side went into the game a point adrift of its opponent, but a deserved victory saw it secure second spot in Group A behind Netherlands, which beat host nation Qatar in the group's other game.
Senegal was brightest from the outset and went ahead in the 44th minute when Watford winger Ismaila Sarr coolly slid home from the penalty spot after he had been fouled.
Moises Caicedo pulled Ecuador level midway through the second half, but Chelsea defender Koulibaly popped up in the 70 th minute to restore Senegal's lead and send it into the last 16.
Senegal squandered two glorious chances inside the opening 10 minutes, Idrissa Gueye and Boulaye Dia flashing efforts just wide from inside the penalty area.
Sarr went close with a whipped effort from distance midway through the first half, before Pathe Ciss looped a header onto the roof of the net.
Senegal's dominance was rewarded a minute before the interval when Sarr slotted home from the spot after he had been brought down in the area by Piero Hincapie.
Ecuador was much improved after the break and they drew level in the 67th minute when Caicedo tapped home at the back post after Felix Torres had flicked a corner on.
Their joy was short-lived, however, as Koulibaly booked Senegal's last-16 spot just three minutes later with a side-footed volley from six yards after a free-kick had been diverted into his path by an Ecuador defender.