Mastery
Mastery is a secondary attribute similar to critical strike chance, haste and spirit. It strengthens your class' abilities depending on your class specialization (or spec). The mastery feature does not unlock until you reach level 80, at which point you can learn it from your class trainer. To find out the effect mastery has on your class and spec, open your "Talents" window -- "N" by default -- and click "View Summaries." Hover your mouse over your spec's mastery to view its effect. If you're a hunter with the beast mastery spec, for example, mastery will increase your pet damage. Mastery for discipline priests increases the power of their protective barriers. Mastery for an assassination rogue increases his poison damage. Mastery for protection paladins increases their chance to block attacks.
Synergy
While mastery's effects are always beneficial, mastery is not necessarily the best attribute for every class and for every class specialization. Secondary attributes such as haste and critical strike work synergistic-ally with mastery, so find a balance that works for your class and spec.
Enchants and Gems
Two ways that you can increase your mastery rating is with enchantment scrolls of enchanters and the gems of jewelcrafters. If your character does not know these professions and you do not know someone who does, you can purchase scrolls and gems off of the auction house. To apply an enchant, right-click the scroll in your inventory and then left-click the gear you want to enchant. To socket a jewelcrafter's gem, hold "Shift" and right-click a piece of armor to open the socket window. Drag the gem from your inventory into the socket and click "Socket."
Reforging
Reforging, which Blizzard introduced with the "Cataclysm" expansion, allows you to convert 40 percent of an item's secondary attribute into a different secondary attribute that is not already present on the item. If the mastery attribute is not featured on a piece of armor by default, you can reforge another of its stats into mastery. Visit the Arcane Reforger near the enchanting trainer in your faction's capital city. Right-click him and select "Reforge an Item" to open the "Reforge" prompt. Place the gear you wish to modify into the slot and choose which attribute you would like to lose and which attribute you would like to gain in exchange. Click "Reforge."