From a terminal use:

sysctl hw.model

In my case:

hw.model: MacBookPro5,2

Update: This still works on OS X Yosemite:

hw.model: MacBookPro10,1