It seems like your men were suffering from extremely poor morale. Did your general have some nasty vices like Bloodlover, Not so Bold or similar?

As for the loss you suffered, you were the attacker so you shouldn't let time run out while waiting for the defender to come to you. The Spanish may have won this losing battle with one unit of peasants hiding in some woods. Seeing that no Spanish units were attacking, you should either have sent your entire force forward or at least sent a scouting unit to search the woods.