Understanding water and salt balances in salt‐affected farming areas is becoming increasingly important because of the growing public interest in controlling salinization. An integrated spatial‐agro‐hydro‐salinity model (SahysMod) was used to model field soil and groundwater salinity dynamics in coastal rainfed farmland, and calibration, error analysis, and sensitivity analysis were performed for the SahysMod model. Results indicated that a leaching efficiency ranging between 0.4 and 0.7 in the root zone, hydraulic conductivity of 0.2 m day−1 and leaching efficiency of 1.2 in the aquifer produced model results best matching the measured data. The predicted root zone soil salinity, average groundwater salinity and level data showed agreement with the observed values when using the determined parameters. Leaching efficiency of the root zone, hydraulic conductivity and leaching efficiency of the aquifer were the most sensitive parameters for soil salinity, groundwater table and groundwater salinity, respectively. Soil and groundwater salinity were moderately sensitive to effective porosity of the root zone and hydraulic conductivity of the aquifer, whereas groundwater level was not sensitive to the leaching efficiency of soil and aquifer. It could be concluded that the SahysMod model can be used as a successful tool to model field water and salt balances in soil and aquifers in a coastal rainfed agroecosystem. Copyright © 2017 John Wiley & Sons, Ltd.