Basically Ethernet switches operate at layer 2. They use the MAC address to make the forwarding decisions, which is the Data Link Layer address.
In more recent times switches have also been developed that can use the Layer 3, or Network Layer, information to make the forwarding decisions. These are then routing packets based on the protocol, such as IP. These are usually known as Layer 3 Switches ! Actually what most of these do is examine the first packet, and then route that one, and add the information about this to the switch data base and switch all the remianing packets in the conversation. This way they can effectively route the packets at much higher speeds than a conventional router which does examine every packet at layer 3..
Hope this answers your question.