A brace each from Alexander Pato and Neymar saw the five-time world champions finish top of the pool, above Venezuela on goal difference.
Pato headed in the opener after 28 minutes, but Caicedo levelled with a low left-foot shot which squirmed under keeper Julio Cesar eight minutes before the break.
At that point Brazil, who will meet Paraguay in the last eight in La Plata next Sunday, were uncomfortably close to the tournament exit but they rallied strongly in the second half, with Neymar and roving wingback Maicon thriving.
Ganso's pass allowed Neymar to make it 2-1 just four minutes after the restart, before Ecuador again clawed their way back as Caicedo drove home confidently.
Then it was all over as Maicon hared down the right and Neymar clipped home his cross from four yards out with 18 minutes remaining.