Chaves (Colombia-Coldeportes) out-sprinted fellow Colombian Sergio Henao (Sky) at the end of the 170km stage, finishing on the Lagunas de Neila mountain top.
Igor Anton (Euskaltel-Euskadi) was 11 seconds behind the pair in third.
Moreno took a 32-second lead over Henao into stage five and was able to remain top of the general classification with a frantic sprint up the final 500m to reduce a near 30-second gap to just 22 on the line.
Chaves's stage win saw him finish third overall, 16 seconds behind Moreno.
