Militarily Hannibal was shrewd in knowing both his own strengths and the weaknesses of the enemy.
Tactically, Carthaginian cavalry was superior to the Roman equivalent. Livy makes this point repeatedly, e.g. XX1.46 "This was the first battle with Hannibal, and the result made it quite clear that the Carthaginian was superior in his cavalry, and consequently that the open plains which stretch from the Po to the Alps were not a suitable battlefield for the Romans." Including elephants on his flank only added to that advantage; "Moreover, the elephants, towering aloft at the ends of the line, terrified the horses not only by their appearance but by their unaccustomed smell, and created widespread panic." (XXI.55).
Strategically, Hannibal depended on good intelligence and worked the Gauls in the north of Italy for allies. His knowledge of Roman battle tactics and the tendencies of Roman commanders led him to fight "dirty". The Roman loss at Trevia, for example, depended on goading the impetuous Roman commander to cross a river past a hidden Carthaginian brigade led by Mago; once the Romans crossed, they were caught in a crossfire from both sides of the river. In another skirmish, when the Carthaginians were forced to retreat, "Hannibal stationed a few men to defend the rampart and the gates (of his camp), the rest he massed in the middle of the camp, and ordered them to be on the alert and wait for the signal to make a sortie. It was now about three o'clock; the Romans were worn out with their fruitless efforts as there was no hope of carrying the camp, and the consul gave the signal to retire. As soon as Hannibal heard it and saw that the fighting had slackened and that the enemy were retiring from the camp, he immediately launched his cavalry against them right and left, and sallied in person with the main strength of his infantry from the middle of the camp."( XXI.60)
It took a while for the Romans to adjust to Hannibal's tactics. To avoid losing more allies, the Romans made new treaties with their Latin neighbors (if they had swung over to Hannibal, it's likely I'd be writing this on the Carthaginian Forum). They also followed the advice of new consul Fabius and fought a guerilla war against the occupying Hannibal. Finally, the Scipios attacked Hannibal's supply lines from Sicily and Spain, a decisive move that also cost Hannibal his brother (the Romans decapitated him in Spain, brought the head back to Italy, and tossed it into Hannibal's camp).
Scipio's successul landing in Africa forced Hannibal to leave Italy, but it was touch and go there for quite a while, mainly because of Hannibal's military genius.