The ear has three part: the outer ear, the middle ear, and the inner ear. The inner ear is the part of the ear that is responsible for balance (and hearing as well). The inner ear has what is called the bony labyrinth, which contains perilymph fluid. The bony labyrinth contains three different sections which are the cochlea, the semicircular canals, and the vestibule. The vestibule connects the cochlea to the semicircular canals. Also, the vestibule contains two structures that are very important to balance and equilibrium. They are the saccule and the utricle. These structures collect information and send it to the brainstem, cerebellum, and spinal cord. In addition, the semicircular canals can also sense changes in movement so that the body can adjust accordingly.
The link that I have posted below gives a very in-depth explanation of how the ear controls the balance of the body.
The innermost part of the ear has two roles to play, one is in hearing and the other is of maintaining our balance.
The vestibular system is the area dedicated to balance. It has thousands of hair cells that are very sensitive and are able to convert pressure waves into mechanical vibrations. These help in detecting altitude and any linear or rotational motion. The information of the altitude or motion detected by them is passed on to the brain which then uses them to ensure that we stay stable and do not topple over when we move. If the vestibular system detects that the body is leaning forwards and is going to fall, the brain immediately takes corrective measures. The reason we feel dizzy and are unable to maintain balance after spinning very fast is that the brain is unable to process the information sent by the pressure sensors at such a fast rate and needs some time to adjust.
More organs of the body are directly involved in maintaining the balance: the eyes, the muscles, (or, more precisely, the muscles' receptors) and, especially, the inner ear (vestibular system). They bring the information that is processed at the cerebellum, in this way the posture of the body being always maintained.
The body has balance and this balance is under control if the body is aware of it's position in space. The first organ that informs the brain about body's position in space is the eye.
At each change of position of the body, the eyes send a different image. Receptors, distributed throughout the body, send information to the brain, about the state of tension of the muscles and about the position of joints.
A large number of information is brought to the brain via the ear.
In the inner ear, there are found semicircular canals that contain a fluid called endolymph, which helps to determine the movements of rotation, acceleration or inclination of the head.This is why after a few spins, endolymph's flow is disturbed and we are feeling dizzy.
The channels that transmit information are arranged at right angles in the three planes. Receptors are stimulated by endolymph's movements, that transmit nerve inflows which are reaching the brain via the vestibular nerve. The brain analyzes the information and, in response, orders to the muscles to permanently correct posture, through fine motions.