Sustainable development of shale reservoirs and enhanced oil recovery have become a challenge for the oil industry in recent years. Shale reservoirs are typically characterized by nano Darcy-scale matrix, natural fractures, and artificially fractures with high permeability. Some of earlier studies have confirmed that gas huff-n-puff has been investigated and demonstrated as the most effective and promising solution for improving oil recovery in tight shale reservoirs with ultra-low permeability. Fractures provide an advantage in enhancing recovery from shale reservoirs but they also pose serious problems such as severe gas channeling, which led to rapid decline production from a single well. More studies are needed to optimize the process. This paper studies the method of foam-assisted N2 huff-n-puff to enhance oil recovery in fractured shale cores. The influence of foam on oil recovery was analyzed. The effect of matrix permeability, cycle number and production time on oil recovery are also considered. The shale core used in the experiment was from Sichuan Basin, China. For the purpose of comparation and validation, two groups of tests were conducted. One group of tests was N2 huff-n-puff, and the other was foam-N2 huff-n-puff. In the optimization experiment, matrix permeabilities were set as 0.01mD, 0.008mD and 0.001mD, cycle numbers ranged from one to five, the production time is designed to be 1 hour and 24 hours respectively. During the puff period of experiments, the history of oil recovery was closely monitored to reveal the mechanism. During a round of gas injection of fractured shale cores, foam-assisted N2 huff-n-puff oil recovery is 4.59%, which is significantly higher than that of N2 huff-n-puff is only 0.0126%, and the contrast becomes more obvious with the increase of matrix permeability. The results also showed that the cumulative oil recovery increased as the number of cycles was increased, with the same experimental conditions. There is an optimal production time to achieve maximum oil recovery. The cycle numbers, matrix permeability, and production time played important roles in foam-assisted N2 huff-n-puff injection process. Therefore, under certain conditions, foam-N2 huff-n-puff has a positive effect on oil development in fractured shale.