Gems

Summary
Gems are the premium in-game currency used to advance players' villages. When players first download the game they begin with 500 Gems (250 of which you are forced to use during the tutorial, and another 8 if you rush the buildings and troops when prompted). Additional Gems can be earned in-game by completing Achievements or clearing Obstacles, or purchased with real money. Gems can be used in several ways:
 * There are several items, such as the Pirate Flag, the Mighty Statue and Builder's Huts, that can only be purchased with a substantial amount of Gems.
 * Gems also can be used to buy other Resources such as Gold, Elixir or Dark Elixir in varying amounts.
 * They can be used to instantly finish the Troop training queues in Barracks and/or Dark Barracks.
 * Gems can also be used to instantly complete the construction or upgrade of Buildings, or Troop upgrades in the Laboratory.
 * Players can also speed up the production of Barracks or resource collectors such as Gold Mines, Elixir Collectors and Dark Elixir Drills for a period of time using Gems.
 * Heroes can be recovered or their healing rate can be increased by gems.

Additional information on Gems can be found on the Resources page.

Purchasing Gems
Gems are available in the shop in the following amounts:

Earning Gems
Gems can be earned in the game by completing Achievements or clearing obstacles. When you complete challenges in the Achievements menu, for example, 'clear 50 obstacles', players are rewarded with Gems. When players gain 3200 trophies, they will be awarded 2000 Gems(3715 if you count all the Gems awarded by trophies). This is the most amount of gems players can earn from achievements, use them wisely.

Another way to earn Gems is to clear obstacles, which are a never-ending (albeit slow) source of Gems. Obstacles will give Experience and anywhere between 1 and 6 Gems whenever they are cleared, although sometimes they may not give any gems at all.

A further (although limited availability) way to earn Gems is to be one in the Top 10 players of the Top 3 Clans. At the end of each two-week period, the Top 3 Clans earn 20,000 Gems for 1st, 10,000 Gems for 2nd and 6,000 Gems for 3rd; these totals are divided equally amongst the Top 10 players of the respective Clans.

Buying Gems With Money!
TEHEE!

Trivia

 * Clash of Clans is free to play, but contains a premium currency (in this case Gems) available for purchase that gives players in-game advantages. These type of games are called 'Freemium' games.
 * As players buy larger amounts of Gems, the cost per Gem decreases.
 * Many (if not most) high-level players buy large quantities of Gems (these players are often called "Gemmers"); Jorge Yao, who was one of the top players in the world, has stated in interviews that he had spent over $2,500 buying Gems.
 * Gems are the only type of resource that cannot be lost when you are raided.