There are endless possibilities for the next generation of mobile social applications that automatically determine your social context. A key element of such applications is ubiquitous and precise sensing of the people you interact with. Existing techniques that rely on deployed infrastructure to determine proximity are limited in availability and accuracy. Virtual Compass is a peer-based relative positioning system that relies solely on the hardware and operating system support available on commodity mobile handhelds. It uses multiple radios to detect nearby mobile devices and places them in a two-dimensional plane. It uses adaptive scanning and out-of-band coordination to explore trade-offs between energy consumption and the latency in detecting movement. We have implemented Virtual Compass on mobile phones and laptops, and we evaluate it using a sample application that senses social interactions between Facebook friends.