At the start of the Second Punic War, Hannibalís army was superior compared to Romeís as his soldiers were professionals and hired mercenaries. Romeís citizen militia was called up only when needed and had to go through training each time. This meant that they were less experienced than Hannibalís army. Even the commanders did not have the needed experience. The fact that Hannibal only used professionals was a weakness of his as well as a strength. There was a limit to the number of professionals available for him. The advantage that Rome had was the endless number of soldiers that could be called up to fight. Their resources for soldiers were almost limitless.
Hannibal had well-trained cavalry and elephants. Though elephants could be intimidating and inflict damage, which was a plus for Hannibal, they were easily frightened and could become out of control. This would work in Romeís advantage. Hannibalís weakness in his military organization was the fact that many of the groups of soldiers were unfamiliar with each other and, therefore, had trouble working together on the battlefield. Roman soldiers worked in sync no matter what their experience was or their background with each other as this was how they were trained. The strength of the Roman formation was in their use of three lines in their phalanx compared to Hannibalís one line. This three line formation gave Rome more fresh reserves to call in than Hannibal had as well as placing more pressure on the enemy.
Rome was able to hold out against Hannibal and eventually defeat him due to the fierce passion that they fought with. Their goal was to fight till the enemy was annihilated. Other civilizations were learning the art of diplomacy and peacemaking. Rome believed that the fight continued until the enemy no longer existed and could no longer threaten them. It was this passion that kept Rome going despite the numerous losses in men and territory. It was what led to Hannibalís defeat at Zama.
By the time Hannibal and Scipio met at Zama, the Roman army had become more experienced and familiar with their enemy. Scipio had been shadowing Hannibalís army and avoiding direct fighting. Hannibal gave Rome the advantage as he let them shadow and did not bring them into combat. The army he faced at Zama was vastly different than the one he first faced. Not directly engaging them earlier and more often gave the Roman army the time needed to become the experienced army it needed to be to defeat Hannibal.
Adrian Goldsworthy, Roman Warfare (London: Phoenix, 2000).