Alternately-layered MgB2/B thin films were prepared on silicon (100) substrates by an electron-beam evaporation technique without any post-annealing. The thickness of each MgB2-layer was designed to be 42, 24 or 15 nm. Cross-sectional transmission electron microscopy observations confirmed that the layered structure was successfully obtained. The critical temperature Tc of the MgB2/B thin film decreased as the MgB2-layer became thinner. We then compared the magnetic field dependence of the critical current density Jc and the global pinning force Fp between the alternately-layered MgB2/B and pure MgB2 thin films. In the MgB2/B film, Jc was higher in fields parallel to the substrate than in perpendicular fields. The Fp -B curve in parallel fields had a clear peak at 4 T, indicating that the maximum Fp was achieved when the quantized fluxon line spacing matched the B-layer spacing. The results suggest a high possibility that the alternately-layered nanostructure improves the superconducting performance of MgB2.