The stochastic evolution of quantum systems during measurement is arguably the most enigmatic feature of quantum mechanics. Measuring a quantum system typically steers it towards a classical state, destroying the coherence of an initial quantum superposition and the entanglement with other quantum systems. Remarkably, the measurement of a shared property between non-interacting quantum systems can generate entanglement, starting from an uncorrelated state. Of special interest in quantum computing is the parity measurement, which projects the state of multiple qubits (quantum bits) to a state with an even or odd number of excited qubits. A parity meter must discern the two qubit-excitation parities with high fidelity while preserving coherence between same-parity states. Despite numerous proposals for atomic, semiconducting and superconducting qubits, realizing a parity meter that creates entanglement for both even and odd measurement results has remained an outstanding challenge. Here we perform a time-resolved, continuous parity measurement of two superconducting qubits using the cavity in a three-dimensional circuit quantum electrodynamics architecture and phase-sensitive parametric amplification. Using postselection, we produce entanglement by parity measurement reaching 88 per cent fidelity to the closest Bell state. Incorporating the parity meter in a feedback-control loop, we transform the entanglement generation from probabilistic to fully deterministic, achieving 66 per cent fidelity to a target Bell state on demand. These realizations of a parity meter and a feedback-enabled deterministic measurement protocol provide key ingredients for active quantum error correction in the solid state.