Use your nasal spray one hour before takeoff and one hour before landing. The nasal spray will cause your nasal mucous membranes to shrink, putting less pressure on your ears.
In addition to your nasal spray, it is also helpful to bring a nasal oil. The air in the cabin is relatively dry.
You can simply carry a nasal spray in your carry-on luggage. Your nasal spray should not exceed 100 milliliters (it usually does) and you should put it in clear and resealable plastic 1-liter bag.
By chewing, on gum for example, you allow pressure to pass through your ear better, reducing ear pain. Chewing gum is usually not for sale in airports, so conveniently bring it from home.
Earplugs or noise-canceling headphones
There are also special ear plugs available that prevent ear pain. Developed for use on airplanes, these will reduce your ear pain during descent and takeoff. It is not the solution, but it can help. Important to know is to never use completely closed earplugs but always use earplugs with an “open” filter to regulate air pressure differences. If you have a real cold, earplugs have little effect.
Noise-canceling headphones can also help well against earaches while flying. An inexpensive variety can be purchased at a DIY store, for example. Put on these headphones while ascending and descending.
The best known and most effective action to perform is the Valsalva maneuver. You pinch your nose shut, and blow towards your nose. The excess pressure created now causes your ear to plop free. You do need to start this in a timely manner; once there is a blockage, it does not work.
If you still suffer from earache after flying, two warm moist wipes can provide relief. You press the warm moist wipes (for example, washcloths or cotton wool) against your ears. The heat and moisture cause the eardrum to “settle down.