Open and slowly close the door, paying close attention to how the latch lines up with the strike plate on the frame. Tighten up the hinge screws with a screwdriver if the door appears to be sagging downward. If any of the screws are rusted or turn in the wood without tightening, have them replaced. The door might need to be lifted to engage the latch if the hinges are loose.
Remove the screws holding the latch plate to the door frame and raise or lower it a little if the latch bolt still does not engage. You might need to chisel away some of the door frame above or below the latch plate's existing position and drill new screw holes to achieve the correct placement. Screw the plate back in and try the door again.
Spray a little graphite powder into the lock mechanism if it feels stiff or hard to turn. Insert and remove the key a few times and engage and disengage the lock to work the material around the tumblers. Graphite powder is commonly used by locksmiths and watch makers to lubricate delicate moving parts. Conventional oils tend to accumulate gunk over time.
Spray a little white lithium grease onto the door hinges if they squeak or are rusted stiff. White lithium grease is available from most hardware stores in spray or paste form. It repels moisture while lubricating moving parts. Open and close the door a few times to work the product around.