If one side destroys the enemy it wins automatically – even if it sustained more casualties. The victors can consolidate or advance as normal. If an advance is chosen it must be made towards the enemy.
Errata — Chapter Approved: Main Rules Clarifications (v2.0): When making an advance after wiping out the enemy, you only need to advance towards the enemy. So, as long as you end up closer to at least one enemy unit more than when you started, all is well.