  We present a Chandra X-ray Observatory ACIS-S variability, spectroscopy, and
imaging study of the peculiar binary containing the millisecond pulsar
J1023+0038. The X-ray emission from the system exhibits highly significant
(12.5 sigma) large-amplitude (factor of 2-3) orbital variability over the five
consecutive orbits covered by the observation, with a pronounced decline in the
flux at all energies at superior conjunction. This can be naturally explained
by a partial geometric occultation by the secondary star of an X-ray--emitting
intrabinary shock, produced by the interaction of outflows from the two stars.
The depth and duration of the eclipse imply that the intrabinary shock is
localized near or at the surface of the companion star and close to the inner
Lagrangian point. The energetics of the shock favor a magnetically dominated
pulsar wind that is focused into the orbital plane, requiring close alignment
of the pulsar spin and orbital angular momentum axes. The X-ray spectrum
consists of a dominant non-thermal component and at least one thermal
component, likely originating from the heated pulsar polar caps, although a
portion of this emission may be from an optically-thin "corona". We find no
evidence for extended emission due to a pulsar wind nebula or bow shock down to
a limiting luminosity of L_X<3.6x10^29 ergs s^-1 (0.3-8 keV), <7x10^-6 of the
pulsar spin-down luminosity, for a distance of 1.3 kpc and an assumed power-law
spectrum with photon index Gamma=1.5.
