When an attack hits, armor is the primary means of reducing damage. Armor is usually derived from equipped items - primarily in the Chest and Helmet slots, though spells, Talents, and potions can increase a character's armor.
Armor is subtracted directly from all incoming damage. E.g., an attack that initially does 20 damage to a target with 7 Armor would be reduced to 13. Armor can never reduce incoming damage below 1.
Note that many pieces of equipment will grant different Armor values against the different Damage Types.
Some types of attacks, such as Damage Over Time effects (Burning, Poison, etc.) and weapon attack Procs are only reduced by 25% of the target's Armor value.
Armor Penetration reduces the effectiveness of the target's armor by a specific amount. So when a target with 5 Armor is hit with an attack with Armor Penetration 2, the target can only use 3 Armor to reduce the damage of the attack. When a weapon lists Armor Penetration among its information, this means that all attacks or abilities using that weapon will gain the benefit.