The posterior dorsomedial striatum (pDMS) is necessary for goal-directed action, however the role of the direct (dSPN) and indirect (iSPN) spiny projection neurons in the pDMS in such action remains unclear. In this series of experiments, we examined the role of pDMS SPNs in goal-directed action and found that, whereas dSPNs were critical for goal-directed learning and for energizing the learned response, iSPNs were involved in updating that learning to support response flexibility. Instrumental training elevated expression of the plasticity marker Zif268 in dSPNs only, and chemogenetic suppression of dSPN activity during training prevented goal-directed learning. Unilateral optogenetic inhibition of dSPNs induced an ipsilateral response bias in goal-directed action performance. In contrast, although initial goal-directed learning was unaffected by iSPN manipulations, optogenetic inhibition of iSPNs, but not dSPNs, impaired the updating of this learning and attenuated response flexibility after changes in the action-outcome contingency.