Engine Oil/Motor Oil is not just a lubricant, but a way to clean, cool, and protect an engine. Engine oil may reduce friction, but it can't eliminate it. Because of this, it must serve other functions as well. Using the right grade of oil will ensure all of these demands are met.
Lubrication
The most well-known and advertised purpose of oil. Many internal components slide against each other in some way, and the friction created from this causes wear, heat, and energy loss, all of which are undesirable.
Cooling
Your engine's oil is the only liquid which can reach many of the internal components, so it must serve as a means to cool them down, too. The heat is transferred from the components to the oil, which is carried down (by gravity) to the oil pan, where it is cooled down by the air passing by the outside of the oil pan, or by an oil cooler system on more advanced engines.
Cleaning
Dirt, carbon, and other materials that don't belong in the engine will always find a way inside. Oil must be able to cling to these materials until it passes through the oil filter, which will capture the material and be thrown out after the recommended lifetime of the filter.
Protection
Modern oil is also designed to add a layer of protection to the surface area of the engine which encounters friction. Constantly adding a protective layer means the material that gets scraped off through friction can be replaced. Engine oil must also protect against corrosives as well. Combustion by-products and moisture can cause acids to form, and the only chemical the engine has to stand in the way of the corrosion process is oil.