Immediately disconnect all peripherals, power cord & remove the battery. Turn the computer over with the lid partly open and the hinge facing upward to let the liquid drain. Do not flop it over and lay it flat - you want to separate it from the moisture. Place paper or cloth towels under the machine to sop up the mess.
After the computer disgorges whatever you spilled on it, don't turn it on for 72 hours or longer. You want to computer to dry out completely before turning it on again.
Some users here swear by hairdryers. Blow drying the innards may bake whatever was in the liquid onto delicate computer components. Better to let the computer air dry.
Use plain tepid water to clean out the computer. If you spilled iced beverage more than likely this ice fried the hot motherboard.
Sugary, acidic or milky drinks will almost always cause problems later on as the residue starts slowly corroding the computer innards.
Swab down any sticky parts with distilled water or denatured alcohol.
If none of the above works, you will need to take the computer to a repair shop. Apple Care does not cover liquid or food damage.