Fergie and Josh Duhamel are having a baby boy.

The Black Eyes Peas star's actor husband revealed the gender of their first child, who is due to arrive into the world at the end of August, for the first time while playing a game on a morning TV show in the U.S.

Asked to choose between a pink and a blue babygrow on a segment for 'LIVE with Kelly and Michael', which will air on Wednesday (17.07.13), the 40-year-old 'Transformers' star initially urged the audience to help him to decide, but then snatched the blue item and held up it triumphantly.

According to People.com, Josh then happily confirmed: ''It's a boy.''

The 'Safe Haven' star recently said that he and Fergie, who has filed court documents to legally change her name from Stacy Ann Ferguson to Fergie Duhamel, were planning to keep their baby's gender a secret.

He previously said: ''It's between us, it's sacred ... it's our little secret.''

The actor can't wait to become a father, even if it means sleepless nights looking after his newborn.

He said: ''Everyone is saying, 'You better sleep now [because] you're not going to get any when the baby's here', [and] 'Oh, your life is over after that', [and] 'Oh, it's the most beautiful thing ever, but it's tough.'

''I look forward to putting the attention [on the baby]. All the love that you have for something like that is what makes it so great and I think we are both ready for that.''