Prime the baseboards before you fill the gaps to aid adhesion of the filling material. Most baseboards are preprimed, and if yours are, omit this step. If yours are bare wood, however, brush on wood primer with a paintbrush, making sure it gets into all the corner gaps, and let it dry.
Fill outside corner gaps with spackling compound, wood filler or drywall joint compound. Work it into each gap with your fingers, allowing it to overfill and bulge out. Scrape it flat with a razor knife before it hardens. Let the filler dry, then sand the area by hand with 150-grit sandpaper. If the filler shrinks, leaving a depression inside the gap, repeat the same process.
Apply acrylic latex caulk to fill inside corners, especially when the baseboard is molded. Put a tube of caulk in a caulking gun and place the tip at the lowest part of the gap. Drag the tip toward the top as you squeeze the trigger. Tool, or smooth, the bead by flattening it with your finger. Do not sand it.
Prime the filler or caulk with wood primer before you paint the baseboard. If you omit this step, the sheen of the filled area may be different from that of the rest of the baseboard, and it will stand out.