Basic cracks can be repaired with a polyurethan solution injection. It's a foam-like sealant that creates a bond between the crack and the foundation, preventing it from widening further. Before using polyurethane solution, be sure to know what your foundation is made of. Different foundation materials will require different types of solution.
Caulk can be used for relatively minor cracks. You'll first need to thoroughly clean out the cracks with a vacuum and stiff wire brush. Once finished, fill the crack with caulk. Allow the caulk to dry, and then paint. Watch the crack over time. If it reappears, call in a professional to assess the problem.
Hydraulic cement is specially made for stopping water in masonry walls. It will set quickly and won't shrink like regular cement. It works best on cracks large enough to allow you to work it into the crack. This means you'll have to clean the crack out thoroughly with a chisel, wire brush and vacuum. Find the source of the crack, then chisel it into an inverted V shape along its length. Since hydraulic cement sets quickly after mixing, you'll need to prepare the crack first, mix the cement, then work quickly. Don't mix too much cement at once. Instead, work in small batches.
If the crack is relatively small and not related to structural problems, you can use epoxy putty to seal it. Epoxy putty is easy to mold and work into small cracks. Be sure to monitor the crack to make sure it doesn't get wider over time. If it does, you'll need to call in a professional or use another type of sealant.