Synaptic plasticity, the experience-induced change in connections between neurons, underlies learning and memory in the brain. Most of our understanding of synaptic plasticity derives from in vitro experiments with precisely repeated stimulus patterns; however, neurons exhibit significant variability in vivo during repeated experiences. Further, the spatial pattern of synaptic inputs to the dendritic tree influences synaptic plasticity, yet is not considered in most synaptic plasticity rules. Here, we address the sensitivity of plasticity to trial-to-trial variability and delineate how spatiotemporal synaptic input patterns produce plasticity with in vivo-like conditions using a data-driven computational model with a calcium-based plasticity rule. Using in vivo spike train recordings as inputs, we show that plasticity is strongly robust to trial-to-trial variability of spike timing, and derive general synaptic plasticity rules describing how spatiotemporal patterns of synaptic inputs control the magnitude and direction of plasticity. Specifically, a high temporal input firing rate to a synapse late in a trial correlated with neighboring synaptic activity produces potentiation, while an earlier, moderate firing rate that is negatively correlated with neighboring synaptic activity produces depression. Together, our results reveal that calcium dynamics can unify diverse plasticity rules and reveal how spatiotemporal firing rate patterns control synaptic plasticity.