Breastfeeding is not supposed to be painful. If your baby two weeks old or younger, you may be experiencing excess interstitial fluid or edema in your breast. This can cause flattening of your nipples due to firmness in your areolas making it difficult for baby to latch. Before each feed, use reverse pressure softening (developed by K. Jean Cotterman RNC-E, IBCLC).
It may be that changing your positioning just a little will help baby to latch more comfortably. First, try laid-back breastfeeding http://www.biologicalnurturing.com/ and allow baby to self-attach. If your nipples are too sore to allow baby to find his own way to the breast, you can try the following techniques to help baby to latch better. http://feedthebabyllc.com/latch-and-positioning/
Also, view this online latch GIF.
If you continue to have pain, even with close attention to positioning and latching, then consider that your baby may have a tongue and/or lip-tie. While it is possible for a baby to nurse with a tongue and lip-tie, it is more difficult for baby and often painful for mom. See lactationkotlowTTnursingbookaugfc2011-1 in order to assess if your baby may be affected by tongue and/or lip-tie.
If you have any damage to the skin of your breast or nipple, it is important to follow a nipple care protocol in order to prevent more damage or infection. http://feedthebabyllc.com/care-plan-for-nipple-damage/
If your baby is at least one week old or your milk supply has significantly increased and it is too painful to breastfeed, you can try using a nipple shield to protect nipples from more damage. Be sure to follow the nipple care protocol in order to heal any damage.
While using a nipple shield, be sure that your breasts are softening and that your baby is doing plenty of swallowing. You may need to express your milk after feeding if baby is not transferring milk well with the nipple shield. To determine if baby is transferring milk see, http://feedthebabyllc.com/care-plan-for-milk-supply/