A lubricant is any material that reduces friction between two surface. It does not have to be a liquid. The powder used to make it easier for keys to go in and out of locks is graphite (similar to powdered coal). Talc (as in talcum powder) is also a lubricant.
Most liquid lubricants are oil. Oil can get into spaces more easily than powders. A very thin film of oil coats itself onto each surface and then the surfaces move as one film of soil moves over the other.