In the standard model of solar flares, a large-scale reconnection current sheet is postulated as the central engine for powering the flare energy release and accelerating particles. However, where and how the energy release and particle acceleration occur remain unclear due to the lack of measurements for the magnetic properties of the current sheet. Here we report the measurement of spatially-resolved magnetic field and flare-accelerated relativistic electrons along a current-sheet feature in a solar flare. The measured magnetic field profile shows a local maximum where the reconnecting field lines of opposite polarities closely approach each other, known as the reconnection X point. The measurements also reveal a local minimum near the bottom of the current sheet above the flare loop-top, referred to as a magnetic bottle. This spatial structure agrees with theoretical predictions and numerical modeling results. A strong reconnection electric field of ~4000 V/m is inferred near the X point. This location, however, shows a local depletion of microwave-emitting relativistic electrons. These electrons concentrate instead at or near the magnetic bottle structure, where more than 99% of them reside at each instant. Our observations suggest that the loop-top magnetic bottle is likely the primary site for accelerating and/or confining the relativistic electrons.