These terms are sometimes used interchangeably, but there are differences between each which it is useful to remember.
A Port is generally a description of a place on the coast which has facilities for boats or ships to call into, and usually a village or town attached. Normally these places developed because the natural features at that particular part of the coastline (a break in the high cliffs, an area of deepwater where the coast is rocky etc.). Because a port is a description of a type of function, ports can look very different from one another and a port may contain all of the things listed below (wharfs, quays, piers etc.). Porto Cervo, in Italy, is a good example.
A Wharf is a man-made structure on a river or by the sea, which provides an area for ships to safely dock. Some are very intricate, with multiple types of berth over a large area, and navigable channels, and others (like this one, below, from Australia) are more straightforward. A Wharf can contain quays and piers and will normally have buildings within it to service the ships (often warehouses and offices). Because of their abundance of unusual buildings and ready-made water features, unused wharfs are often converted into expensive retail and housing areas (for instance Canary Wharf and Butler's Wharf in London).
A Quay is, technically, a part of the river bank or coastline which has been modified so ships can dock at it parallel to the shore. This boat is moored at the quay in Poole, England.
A Pier is a, normally wooden, structure which protrudes from the shore at a level above the water level, allowing ships to disembark passengers in the deeper water further out. The length of the pier may also provide berths for smaller boats.