Based on the Honeywell HMC5883L, the GY-273 sensor module allows you add an electronic compass to your projects. While coding for the device can be a bit of a chore, there available libraries that make putting it to practical us a snap.
The device communicates with your Arduino via I2c.
This tutorial will show you how to connect the sensor and run sample sketch. It will also point you to a fantastic Adafruit library that will make using the device easy.