You can only collect gems if you manage to bring together 3 gems either horizontally or vertically. It is important to know that you only can swap gems if they are next to each other either horizontally or vertically. You can also only collect a max of 50 gems in each color. Health and shield is also maxed at 50, so don't use i.e. your healing spell if your health is at or near the max value of 50.
The black skulls on the gameboard are another source for dealing damage to your opponent. Also with collecting the gems you can cast several spells to weaken your opponent or to save yourself!
You win, as soon your opponent lost all his health- and shieldpoints.