A two-step procedure for the formation of silver nanoparticles embedded in a glass matrix is studied. The procedure consists of: i) the inclusion of silver ions in the glass matrix by electric field assisted dissolution of Ag film deposited on the glass and ii) the aggregation of silver by thermal annealing. The optical properties of the sample, dominated by the surface plasmon resonance of metal nanoparticles in the visible spectral range, are studied by optical spectroscopy. The structural characterization is carried out by grazing-incidence small-angle X-ray scattering measurements performed at the Synchrotron Elettra (Italy) and silver depth profiles are determined using Rutherford backscattering. The results suggest that the depth profile of Ag might be tailored by modification of the parameters of metal film dissolution (electric field and temperature). Variation of thermal annealing parameters (temperature and time) allows control of the nanoparticles size. Thus, the surface plasmon absorption intensity and line shape is changed, enabling tuning of the optical properties of the sample.