At their height, the Roman legions were truly the legendary fighting force they are remembered as for a number of reasons:
They were highly disciplined. The rules the legionnaires were expected to follow were rigorous, and punishment for infractions was harsh. Furthermore, discipline was very consistent across all legions, so there was not a significant variance in quality from one unit to the next.
They were well armed and equipped, and there was diversification in the composition of troops. In addition to the classic image of the heavy infantry we associate with Hollywood productions (each wearing body armor and helmet and carrying a shield, gladius and pilum), a legion also comprised a cavalry force, both heavy and light, intended to protect against flanking actions by opposing cavalry as well as to break up enemy infantry units. They also had light infantry units, or velites, armed with javelins who served as both skirmishers and as scouts.
Their tactics were effective. The typical assault began with the velites advancing to hurl their javelins, then retreat behind the heavy infantry. The heavy infantryman would wait until opponents were within 30 yards, then hurl his pilum into the ranks of the enemy. He would then lock shields with his neighbors to form a shield wall and use his gladius to stab, not hack, at his opponent over the top of his shield, or under it to hamstring the enemy. Meanwhile, the cavalry would maneuver around the flanks to either harrass the opposing infantry or engage the opposing cavalry. Furthermore, they chose to put their greenest troops in the front ranks of the legion, for two reasons — veteran soldiers were too valuable to risk in a frontal assault, and with them ranked behind the inexperienced troops they could simultaneously encourage them and help prevent them from abandoning the front line and retreating toward the rear.
They were flexible. Legions were defeated in battle from time to time, quite famously. However, instead of rigidly clinging to the tactics they had trained for, the Roman commanders would adapt their tactics to adjust for situations that had previously worked against them.
When it came to siege warfare, the Romans were undisputed masters. Their ingenuity in siege engineering, both in equipment and in infrastructure, was second-to-none in the ancient world.