Four giant hourglasses – one for each house – stand in niches in a corner opposite the main doors in Hogwarts’ Entrance Hall; they automatically track house points (PS15).
When house points are awarded, gemstones fall from the upper bulb into the lower bulb; when house points are taken, gemstones (if there are any) retreat into the upper bulb from the lower bulb (OP28, OP38).
It is possible, though not common, for a house to be in negative points; judging from Snape's reaction when he was about to put the Gryffindor hourglass into this state, some sort of silent warning may be triggered to inform the point-taker when this is about to occur (OP38).
Gryffindor's hourglass contains rubies, Ravenclaw's sapphires, and Slytherin's emeralds (OP28, OP38), reflecting the respective house colours. Hufflepuff's hourglass contains diamonds, as revealed on Twitter by Rowling.
Inconsistency: The set designers for the films placed the hourglasses in the Great Hall, on the wall behind the staff table. The artists on Pottermore depicted the hourglasses on the same wall as the front door of the castle. Neither placement matches the text of the books, which states that the hourglasses are on the opposite wall from the front door.