If you plug an Apple iPhone headphone remote or compatible model into a MacBook you can control iTunes by pressing the button just like on the iPhone.
Editor’s note: This should work on all recent Macs made within the last 2-3 years, including the iMac and I believe the Mac Pro.