The federal jobs data that the Bureau of Labor Statistics releases on the first Friday of each month at 8:30 a.m.
Spicer later apologized and said while he understood the objective of the rule, his tweet didn't impact markets because the data had already been released.
Social media users saw the message as evidence that Mr. Trump had seen the numbers, and that they were good.
Back in 2002, when Trump was still just a businessman, the Securities and Exchange Commission forced his casino company to sign a cease and desist agreement after an investigation showed it had used "fraudulent" reporting tactics and doctored accounting in its public earnings statements.
The latest report showed the US economy added 223,000 jobs in May and reflected a 0.1 percent decline in the unemployment rate to 3.8, an 18-year low, further bolstering Trump's argument that his administration's work has greatly helped the economy.
The Trump administration is examining ways US industries can hire more immigrant workers on a temporary basis, White House economic adviser Larry Kudlow said on Friday. "I don't he gave anything away incidentally".
"Why not?" Mr. Kudlow said.
"He chose to tweet", Kudlow said, asserting that Trump had followed both the rules and past practices.
Looking forward to seeing the employment numbers at 8:30 this morning.
Teacher Who Stopped Indiana School Shooter: There Was No Other Choice
For the first time since the shooting, classes will resume Tuesday at district schools except for Noblesville West Middle School. If not for his Seaman's heroics, one student told reporters, "more of us could have been injured, for sure".
Trump and his administration have run afoul of the rule before, but only after the data was released.
All employees of the Executive Branch who receive prerelease distribution of information and data estimates as authorized above are responsible for assuring that there is no release prior to the official release time.
Rules stipulate that no federal worker is allowed to comment on the jobs report until at least one hour after its release.
The goal of the rule should be self-evident.
Speaking to reporters ahead of his departure for Texas on Thursday, Trump spoke glowingly about the "best unemployment we've had in many, many decades", though it's unclear if he was just speaking generally about the state of the economy or was speaking specifically to the content of the May report.
According to analysts, the figures increased the likelihood of a June interest rate hike by the USA central bank, the Federal Reserve. Traders react to even the slightest hint, moving markets and causing turmoil on incomplete information.
Journalists get an early look at the report the morning of its release in a special room at the Labor Department with no internet or cellphone access to prevent any news coming out before the official release time.
But a 1985 directive from the Office of Information and Regulatory Affairs says that when monthly jobs reports are released, "employees of the Executive Branch shall not comment publicly on the data until at least one hour after the official release time".
Trump wasn't guessing. He received a phone call Thursday night aboard Air Force One from his top economic adviser, Larry Kudlow, informing him of the good numbers. That's why giving the market any kind of clue ahead of time is extremely unusual. "No one revealed the numbers to the public". Trump previewed this month's strong report with a tweet, so if in upcoming months he doesn't say anything before the report is released, people could panic that the report will be weak and the market will plunge.