Your water heater leaking from the top is usually repairable, which is genuinely good news compared with a bottom leak.
The most frequent cause is a loose or corroded connection at the cold inlet or hot outlet nipple, where dissimilar metals cause galvanic corrosion over years of service.
Tightening the fittings or replacing the nipples with dielectric unions solves most cases.
The temperature and pressure relief valve, mounted near the top on many models, may weep because system pressure exceeds its rating or because debris prevents proper seating.
Failed inlet and outlet gaskets, a cracked plastic anode rod port, or a loose expansion tank fitting also leak.
On electric units, water can seep around a heating element gasket and run down the shell.
Always shut off water and power, dry everything, then inspect each fitting individually under normal operating pressure.