The actual spending priority depends on how much max-level game-playing you plan on doing, but the following are necessary gem purchases:
• Additional hero ability slots
• Additional hero slots
• Additional minion slots
• Minions from the store
• Additional inventory slots (on individual heroes and the shared stash)
• Reforged gear at max level