Wave phenomena in the ocean can fluctuate like other weather parameters, making forecasting challenging. Wave forecasting is needed to support daily marine activities such as marine transportation scheduling and daily operation offshore or in the harbor. Significant wave height (SWH) and peak wave period (Tp) predictions are essential to wave forecasting. In this research, we perform a time series wave forecasting for SWH and Tp using a relatively recent deep learning model, i.e., Transformer. As a case study, we choose a location in the southern part of Java island, Indonesia, i.e., on the Cilacap coast. We also compare the Transformer results with the well-known LSTM model, which shows that the Transformer model performs better in terms of correlation coefficient and root mean squared error than the LSTM model for Hs. At the same time, LSTM came as a better model for Tp than the Transformer.