We study fluctuations of electric current in a quantum resistor and derive a general quantum-mechanical formula for the distribution of transmitted charge. For that we introduce a scheme of current measurement that involves a spin $1/2$ coupled to the current so that it precesses at the rate proportional to the current. Our approach allows the study of charge transfer without breaking the circuit. We analyze a single channel conductor and derive electron counting statistics for arbitrary relation between temperature and voltage. For a perfectly transmitting channel the counting distribution is gaussian, both for zero-point fluctuations and at finite temperature. At constant voltage and low temperature the distribution is binomial, i.e., it arises from Bernoulli statistics.