Topochemical reactions provide selective products based on the molecular position; however, they generally require molecules to be placed in strictly limited orientations and distances, making them less versatile. In this study, we found that by confining trans-4-styrylpyridine (4spy) as a reactive substrate in a flexible metal−organic framework (MOF) nanospace, [2+2] cycloadducts can be selectively obtained, even when the distance between two C�C bonds of 4-spy in the crystal is 5.9 Å, which is much larger than the conventionally observed upper limit (4.2 Å). Such an unusual cyclization reaction is suggested to occur due to the transient proximity of the 4-spy due to the "swing" motion in the nanospace. The MOF nanospace, with its high degree of molecular structural freedom, can be applied to different platforms that do not require the fine constraints of reactive distances for solid-phase reactions.