Control over physical systems at the quantum level is important in fields as diverse as metrology, information processing, simulation and chemistry. For trapped atomic ions, the quantized motional and internal degrees of freedomcan be coherentlymanipulated with laser light1,2. Similar control is difficult to achieve with radiofrequency or microwave radiation: the essential coupling between internal degrees of freedom and motion requires significant field changes over the extent of the atoms’ motion2,3, but such changes are negligible at these frequencies for freely propagating fields. An exception is in the near field of microwave currents in structures smaller than the free-space wavelength4,5, where stronger gradients can be generated. Here we first manipulate coherently (on timescales of 20 nanoseconds) the internal quantum states of ions held in a microfabricated trap. The controlling magnetic fields are generated by microwave currents in electrodes that are integrated into the trap structure. We also generate entanglement between the internal degrees of freedom of two atoms with a gate operation4,6–8 suitable for general quantum computation9; the entangled state hasa fidelity of 0.76(3), where the uncertainty denotes standard error of the mean. Our approach, which involves integrating the quantum control mechanism into the trapping device in a scalable manner, could be applied to quantum information processing4, simulation5,10 and spectroscopy3,11.