  As a sub-array of the Large High Altitude Air Shower Observatory (LHAASO),
KM2A is mainly designed to cover a large fraction of the northern sky to hunt
for gamma-ray sources at energies above 10 TeV. Even though the detector
construction is still underway, a half of the KM2A array has been operating
stably since the end of 2019. In this paper, we present the pipeline of KM2A
data analysis and the first observation on the Crab Nebula, a standard candle
in very high energy gamma-ray astronomy. We detect gamma-ray signals from the
Crab Nebula in both energy ranges of 10$-$100 TeV and $>$100 TeV with high
significance, by analyzing the KM2A data of 136 live days between December 2019
and May 2020. With the observations, we test the detector performance including
angular resolution, pointing accuracy and cosmic ray background rejection
power.
  The energy spectrum of the Crab Nebula in the energy range 10-250 TeV fits
well with a single power-law function dN/dE
=(1.13$\pm$0.05$_{stat}$$\pm$0.08$_{sys}$)$\times$10$^{-14}$$\cdot$(E/20TeV)$^{-3.09\pm0.06_{stat}\pm0.02_{sys}}$
cm$^{-2}$ s$^{-1}$ TeV$^{-1}$. It is consistent with previous measurements by
other experiments. This opens a new window of gamma-ray astronomy above 0.1 PeV
through which ultrahigh-energy gamma-ray new phenomena, such as cosmic
PeVatrons, might be discovered.
