  Aims. We report the results of a novel determination of the solar oxygen
abundance using spatially resolved observations and inversions. We seek to
derive the photospheric solar oxygen abundance with a method that is robust
against uncertainties in the model atmosphere.
  Methods. We use observations with spatial resolution obtained at the Vacuum
Tower Telescope (VTT) to derive the oxygen abundance at 40 different spatial
positions in granules and intergranular lanes. We first obtain a model for each
location by inverting the Fe I lines with the NICOLE inversion code. These
models are then integrated into a hierarchical Bayesian model that is used to
infer the most probable value for the oxygen abundance that is compatible with
all the observations. The abundance is derived from the [O I] forbidden line at
6300 {\AA} taking into consideration all possible nuisance parameters that can
affect the abundance.
  Results. Our results show good agreement in the inferred oxygen abundance for
all the pixels analyzed, demonstrating the robustness of the analysis against
possible systematic errors in the model. We find a slightly higher oxygen
abundance in granules than in intergranular lanes when treated separately
(log(\epsilon_O) = 8.83 \pm 0.02 vs log(\epsilon_O) = 8.76 \pm 0.02), which is
a difference of approximately 2-{\sigma}. This tension suggests that some
systematic errors in the model or the radiative transfer still exist but are
small. When taking all pixels together, we obtain an oxygen abundance of
log(\epsilon_O)=8.80 \pm 0.03, which is compatible with both granules and lanes
within 1-{\sigma}. The spread of results is due to both systematic and random
errors.
