Run a sharp utility knife along both sides of the crack and clean out the area between. Cracks typically have dust and protruding paint making a mess of the area, and this will give you a clean space with which to work. If you find drywall tape within the crack, work this free and remove it.
Use a stud finder to locate the nearest stud on either side of the crack. Place screws in the drywall on both sides to secure it to the underlying stud. Use a screw on both sides about every 6 inches along the entire length of the crack.
Fill the crack with drywall mud using a putty knife. Let the mud dry for at least 24 hours before proceeding to the next step.
Examine the dried drywall mud. If it sticks up above the surrounding wall, sand it down with sandpaper until the wall is flat. If it has shrunken to the point where it no longer fills the crack, apply additional mud and repeat this step after another 24 hours.
Lay a piece of mesh tape over the newly sealed crack. Use you putty knife to apply drywall mud on top of the tape. Allow 24 hours for the mud to dry.
Use a larger putty knife to apply a final coat of drywall mud to the wall. Extend your coverage about 6 inches on either side of the original crack. This will allow you to taper off the drywall gently so the wall appears completely flat. Wait 24 hours, then proceed to the next step.
Sand down the area as needed until the wall is smooth and flat. The tape should be completely concealed and the original crack imperceptible. Wipe the wall down with a soft cloth to remove dust.
Apply a coat of drywall primer to the newly drywalled area. After the primer has dried, apply a fresh coat of paint to the entire wall. Painting only the repaired area typically results in a noticeable discoloration, since the existing paint has faded over time from its original hue. Painting the whole wall masks this problem.