Spatially resolved tissue lipidomics is essential for accurate intraoperative and postoperative cancer diagnosis by revealing molecular information in the tumor microenvironment. Matrix-free laser desorption ionization mass spectrometry imaging (LDI-MSI) is an emerging attractive technology for label-free visualization of metabolites distributions in biological specimens. However, the development of LDI-MSI technology that could conveniently and authentically reveal molecular distribution on tissue samples is still a challenge. Herein, we present a tissue imprinting technology by retaining tissue lipids on 2D nanoflakes-capped silicon nanowires (SiNWs) for further mass spectrometry imaging and cancer diagnosis. The 2D nanoflakes were prepared by liquid exfoliation of molybdenum disulfide (MoS2) with nitrogen-doped graphene quantum dots (NGQDs), which serve as both intercalation agent and dispersant. The obtained NGQD@MoS2 nanoflakes were then decorated on the tip of vertical SiNWs, forming a hybrid NGQD@MoS2/SiNWs nanostructure, which display excellent lipid extraction ability, enhanced LDI efficiency and molecule imaging capability. The peak number and total ion intensity of different lipids species on animal lung tissues obtained by tissue imprinting LDI-MSI on NGQD@MoS2/SiNWs were ∼4-5 times greater than those on SiNWs substrate. As a proof-of-concept demonstration, the NGQD@MoS2/SiNWs nanostructure was further applied to visualize phospholipids on sliced non small cell lung cancer (NSCLC) tissue along with the adjacent normal tissue. On the basis of selected feature lipids and machine learning algorithm, a prediction model was constructed to discriminate NSCLC tissues from the adjacent normal tissues with an accuracy of 100% for the discovery cohort and 91.7% for the independent validation cohort.