Lightweight magnesium alloys are attractive as structural materials for improving energy efficiency in applications such as weight reduction of transportation vehicles. One major obstacle for widespread applications is the limited ductility of magnesium, which has been attributed to dislocations failing to accommodate plastic strain. We demonstrate, using in situ transmission electron microscope mechanical testing, that dislocations of various characters can accommodate considerable plasticity through gliding on pyramidal planes. We found that submicrometer-size magnesium samples exhibit high plasticity that is far greater than for their bulk counterparts. Small crystal size usually brings high stress, which in turn activates more dislocations in magnesium to accommodate plasticity, leading to both high strength and good plasticity.