When ammonia, #NH_3#, dissolves in water, hydrogen ions are translerred from the water to ammonia to form ammonium ions and hydroxide ions. Ths reaction can be seen below. Why is ammonia a base in this reaction?
#H_2O + NH_3 -> OH^- + NH_4^+#
Because ammonia has acted as an electron pair donor.
In acting as an electron pair donor, the nitrogen has become quaternized, and has demonstrably increased hydroxide ion concentration. It has therefore acted as a base by several definitions.